metrics-generator disable x-scope-orgid header append#2974
metrics-generator disable x-scope-orgid header append#2974joe-elliott merged 6 commits intografana:mainfrom vineetjp:metrics-generator-disable-x-scope-orgid
Conversation
|
Fixes #2973 |
joe-elliott
left a comment
There was a problem hiding this comment.
thanks for this improvement!
A couple of small comments, but overall it's looking good.
1. Changed removeOrgIdHeader to addOrgIdHeader 2. addOrgIdHeader default value will be true
Co-authored-by: Joe Elliott <joe.elliott@grafana.com>
yvrhdn
left a comment
There was a problem hiding this comment.
Changes look good overall, just left a comment about removing pre-existing X-Scope-OrgID headers
| } | ||
|
|
||
| cloneCfg.Headers[user.OrgIDHeaderName] = tenant | ||
| if addOrgIDHeader { |
There was a problem hiding this comment.
I'm wondering if we should move this if-case higher and merge it with if tenant != util.FakeTenantID at line 24.
Make it:
if tenant != util.FakeTenantID && addOrgIDHeader {Reasoning: we only need to remove any pre-existing X-Scope-OrgID headers if we want to inject our own. If we are not injecting any, there won't be a conflict and we don't need to remove them either.
We have the following possible scenarios:
- single-tenant: we don't remove X-Scope-OrgID
- multi-tenant with
addOrgIDHeader = true: we remove X-Scope-OrgID headers and inject our own - multi-tenant with
addOrgIDHeader = false: we do not inject our own X-Scope-OrgID header so I don't think we need to remove them as well
There was a problem hiding this comment.
yvrhdn
left a comment
There was a problem hiding this comment.
LGTM! I'll give Joe a chance to check in again as well 🙂
joe-elliott
left a comment
There was a problem hiding this comment.
Nice addition. Thanks!
What this PR does:
Adds option to disable addition of X-Scope-OrgID header in metrics generator with remote writing
Which issue(s) this PR fixes:
Fixes #1554
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]