Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enable tenant ID selection for multi-tenant queries.#5821

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jeschkies merged 8 commits intografana:mainfromjeschkies:karsten/tenant-filter
Apr 13, 2022

Conversation

jeschkies
Copy link
Contributor

What this PR does / why we need it:
This pull request will add tenant ID filtering such as{__tenant_id__="1"} to multi-tenant queries. It does not add filter such as{app="loki"} | __tenant_id__="1".

We are parsing the select logs or select samples queries and find the matcher. It is then removed and the non-matching tenants are ignored.

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

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated
  • Add an entry in theCHANGELOG.md about the changes.

returnlogproto.MergeSeriesResponses(responses)
}

// See https://github.com/grafana/mimir/blob/114ab88b50638a2047e2ca2a60640f6ca6fe8c17/pkg/querier/tenantfederation/tenant_federation.go#L29-L69
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Should we share this code or is copying fine?

@jeschkiesjeschkies changed the titleEnable tenant ID selection for mutli-tenant queries.Enable tenant ID selection for multi-tenant queries.Apr 8, 2022
@jeschkiesjeschkies marked this pull request as ready for reviewApril 11, 2022 13:31
@jeschkiesjeschkies requested a review froma team as acode ownerApril 11, 2022 13:31
}

// replaceMatchers traverses the passed epxression and replaces all matchers.
funcreplaceMatchers(expr syntax.SampleExpr,matchers []*labels.Matcher) syntax.SampleExpr {
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@ssncferreira and@chaudum, I've added you because I saw a mapper in your recent changes. I'm wondering if we should add a visitor pattern to the AST. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a too big fan of the visitor pattern, because it can be much harder to understand than a the simpleWalk() we have atm. Is there an issue the visitor pattern could solve, thatWalk() can't?

@jeschkies
Copy link
ContributorAuthor

It works 🎉
image

JordanRushing reacted with hooray emoji

Copy link
Contributor

@cyriltovenacyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

just improve the LogQL parsing.

Copy link
Contributor

@JordanRushingJordanRushing left a comment

Choose a reason for hiding this comment

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

Looks great! I've drafted a quick test for thesliceToSet() util function:JordanRushing@8922c29 -- feel free to bring it in to this PR but not blocking.

jeschkies reacted with thumbs up emoji
@jeschkiesjeschkies merged commit7c78b26 intografana:mainApr 13, 2022
@jeschkiesjeschkies deleted the karsten/tenant-filter branchApril 13, 2022 09:15
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@cyriltovenacyriltovenacyriltovena approved these changes

@JordanRushingJordanRushingJordanRushing approved these changes

@simonswinesimonswineAwaiting requested review from simonswine

@ssncferreirassncferreiraAwaiting requested review from ssncferreira

@chaudumchaudumAwaiting requested review from chaudum

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Support selections on__tenant_id__ in multi-tenant queries.

4 participants

@jeschkies@chaudum@cyriltovena@JordanRushing

[8]ページ先頭

©2009-2025 Movatter.jp