Skip to content
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

Fix multitenancy when using OTLP HTTP #1781

Merged

Conversation

gouthamve
Copy link
Member

@gouthamve gouthamve commented Oct 4, 2022

Which issue(s) this PR fixes:
Fixes #495

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@CLAassistant
Copy link

CLAassistant commented Oct 4, 2022

CLA assistant check
All committers have signed the CLA.

@gouthamve gouthamve force-pushed the make-multitenancy-work-with-otlp-http branch from 2a7b8cc to 7839cd6 Compare October 4, 2022 15:07
Copy link
Contributor

@zalegrala zalegrala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay to me, thanks for the PR. I'll give my teammates a chance to review also.

Copy link
Member

@mapno mapno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Could you add a changelog entry?

@gouthamve gouthamve force-pushed the make-multitenancy-work-with-otlp-http branch from 7839cd6 to 391aa3b Compare October 5, 2022 14:31
@gouthamve
Copy link
Member Author

Done!

info := client.FromContext(ctx)
orgIDs := info.Metadata.Get(user.OrgIDHeaderName)
if len(orgIDs) != 1 {
log.Logger.Log("msg", "failed to extract org id", "err", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add more detail to this error message? now it represents 2 errors in a row. failure to pull the orgid from grpc and failure to pull the orgid from http. perhaps we can log the value of orgIDs as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the error message @joe-elliott

But note that https://github.com/weaveworks/common/blob/master/user/grpc.go#L8-L22 the GRPC extractor doesn't log when multiple orgids are present.

@gouthamve gouthamve force-pushed the make-multitenancy-work-with-otlp-http branch from 2ca81ec to 4c9e645 Compare October 6, 2022 13:20
Fixes grafana#495

Signed-off-by: Goutham Veeramachaneni <[email protected]>
Signed-off-by: Goutham Veeramachaneni <[email protected]>
@gouthamve gouthamve force-pushed the make-multitenancy-work-with-otlp-http branch from 4c9e645 to 50f8b0e Compare October 6, 2022 13:23
@joe-elliott
Copy link
Member

Thanks @gouthamve! I think you just fixed one of our oldest open issues 🙏

@joe-elliott joe-elliott merged commit 964abf1 into grafana:main Oct 6, 2022
@gouthamve gouthamve deleted the make-multitenancy-work-with-otlp-http branch October 6, 2022 15:35
joe-elliott pushed a commit to joe-elliott/tempo that referenced this pull request Oct 7, 2022
* Fix multitenancy when using OTLP HTTP

Fixes grafana#495

Signed-off-by: Goutham Veeramachaneni <[email protected]>

* review feedback

Signed-off-by: Goutham Veeramachaneni <[email protected]>

Signed-off-by: Goutham Veeramachaneni <[email protected]>
@liguozhong
Copy link

great👍,thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multitenancy does not work with non-GRPC ingestion
6 participants