-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
query-tee: add per-backend request headers #10081
query-tee: add per-backend request headers #10081
Conversation
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
What if we used a YAML config file instead? Putting JSON into a CLI flag feels a little awkward. |
that will make setting this up a bit hard. I'm thinking about the additional jsonnet to create a config map and mount it. But I'm not opposed, so I'll draft that |
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
see 3ce31d1 |
Something for a future PR, not this one: would be good to move some of the config to the config file as well (eg. configuring the proportion of requests sent to a secondary backend per backend, rather than for all secondary backends). |
I thought about this and I'm not sure if it's compatible with results comparisons: we need the same sampling rate for all backends and the primary in order to compare results. I think it doesn't work for us. Let's keep discussing though. I'll merge this PR so we have something in the weekly next week |
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, approving first to unblock since we want to merge this soon and Charles has already reviewed it
tools/querytee/proxy_backend_test.go
Outdated
@@ -84,7 +84,7 @@ func Test_ProxyBackend_createBackendRequest_HTTPBasicAuthentication(t *testing.T | |||
orig.Header.Set("X-Scope-OrgID", testData.clientTenant) | |||
} | |||
|
|||
b := NewProxyBackend("test", u, time.Second, false, false) | |||
b := NewProxyBackend("test", u, time.Second, false, false, BackendConfig{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Do you think we should have a defaultBackendConfig()
instead (we can set it to return BackendConfig{}
for now) or is it unlikely that we'll ever need to set some values as default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah let's try that. pushed in 44c8d42
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
* Add tests Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> * Add headers to proxy Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> * Add CHANGELOG.md entry Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> * Use YAML config instead Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> * Add comment for why we allow choosing by index too Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> * Validate list of backends Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> * Add util function for BackendConfig Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> * Fix validation Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> --------- Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
What this PR does
One of my backends needs a specific header so that it returns "correct" results.
Currently we don't have a way to add per-backend configuration. This PR introduces a new flag which takes JSON and allows to configure each backend separately. It will be used like so
I'm open to suggestions in case this is not a route we want to go on.
Which issue(s) this PR fixes or relates to
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.