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

Support limits in multi-tenant queries. #5626

Merged
merged 13 commits into from
Mar 17, 2022

Conversation

jeschkies
Copy link
Contributor

@jeschkies jeschkies commented Mar 15, 2022

What this PR does / why we need it:
This changes adds support for the the following limits in multi-tenant queries:

  • MaxQuerySeries
  • QuerySplitDuration
  • MaxEntriesLimitPerQuery
  • MinShardingLookback
  • MaxQueryLength
  • MaxQueryParallelism
  • MaxQueriersPerUser
  • MaxCacheFreshness

It always uses the more restricted limit. That means the smallest MaxQuerySeries but biggest QuerySplitDuration. The split duration is special. Zero means disabled.

Also, the global default resolver is the multi tenant resolver when multi-tenant queries are enabled. This will result HTTP 400 errors in case the user sends multiple tenants to endpoints that do not support it.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Checklist

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

@jeschkies jeschkies requested a review from a team as a code owner March 15, 2022 16:17
pkg/logql/downstream.go Outdated Show resolved Hide resolved
pkg/querier/queryrange/split_by_interval.go Show resolved Hide resolved
@pull-request-size pull-request-size bot added size/M and removed size/L labels Mar 15, 2022
Copy link
Contributor

@simonswine simonswine left a comment

Choose a reason for hiding this comment

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

Thanks for working on this. Figuring out limits relating to multi tenant federation certainly feels quite arbitrary.

I think we can take a pragmatic stance and accept no ability for defining custom limits for federated tenant for now.

pkg/querier/queryrange/split_by_interval.go Show resolved Hide resolved
pkg/logql/downstream.go Outdated Show resolved Hide resolved
@jeschkies jeschkies changed the title Support MaxQuerySeries and QuerySplitDuration. Support limits in multi-tenant queries. Mar 16, 2022
@jeschkies jeschkies requested a review from simonswine March 16, 2022 17:09
jeschkies and others added 3 commits March 16, 2022 18:10
Signed-off-by: JordanRushing <rushing.jordan@gmail.com>
Signed-off-by: JordanRushing <rushing.jordan@gmail.com>
@JordanRushing
Copy link
Contributor

JordanRushing commented Mar 16, 2022

I've authored some tests for limits-related util functions as well as a quick fix for MaxDurationOrZeroPerTenant:

JordanRushing/loki@karsten/multi-tenant-max-queries^^...JordanRushing:karsten/multi-tenant-max-queries

I'm happy to push these commits to this PR or to PR the underlying fork; please let me know!

@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 17, 2022
Copy link
Contributor

@JordanRushing JordanRushing left a comment

Choose a reason for hiding this comment

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

LGTM!

@jeschkies jeschkies merged commit 3d5a393 into grafana:main Mar 17, 2022
@jeschkies jeschkies deleted the karsten/multi-tenant-max-queries branch December 14, 2022 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants