Skip to content

Fix multitenancy when using OTLP HTTP#1781

Merged
joe-elliott merged 2 commits intografana:mainfrom
gouthamve:make-multitenancy-work-with-otlp-http
Oct 6, 2022
Merged

Fix multitenancy when using OTLP HTTP#1781
joe-elliott merged 2 commits intografana:mainfrom
gouthamve:make-multitenancy-work-with-otlp-http

Conversation

@gouthamve
Copy link
Copy Markdown
Contributor

@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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Contributor

@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
Copy Markdown
Contributor 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
Copy Markdown
Collaborator

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
Copy Markdown
Contributor 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 <gouthamve@gmail.com>
Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
@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
Copy Markdown
Collaborator

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 <gouthamve@gmail.com>

* review feedback

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
@liguozhong
Copy link
Copy Markdown

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