datasources: apiserver: removed unnecessary code #113384
Open
+1
−49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
the datasource apiserver code explicitly adds a list of headers to
QueryDataRequest.Headers:grafana/pkg/registry/apis/datasource/sub_query.go
Line 94 in fc34b18
if we compare this to how single-tenant grafana does it, single-tenant grafana just creates an empty headers-field:
grafana/pkg/services/query/query.go
Lines 304 to 307 in fc34b18
the needed headers will be later added by various middlewares.
to make the apiserver-code more similar to single-tenant grafana, i did the same change in apiserver-code.
then i tested this, and all the headers from https://github.com/grafana/grafana/blob/fc34b181226e8caa5bbbcfc47de0c1bd132fb16f/pkg/registry/apis/query/header_utils.go are still getting set correctly.
there is one exception: the
X-Cache-Skipheader was forwarded before, but it is not after this change. but, i checked single-tenant grafana, and they also do not forwardX-Cache-Skip, so i think that is ok.(the motivation here is that i need a different header-list for
query.goand a different one forsub_query.go. if i can removeExtractKnownHeadersfromsub_query.go, it will make my work easier.(also a unit-test was removed, because now there is no functionality to test. also, while in theory, the unit-test could have been kept, it would not work in it's current form, it would need substantial additions to also call the middlewares that populate the headers)