-
Notifications
You must be signed in to change notification settings - Fork 828
resource based throttling: reject only adhoc queries #6947
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
base: master
Are you sure you want to change the base?
resource based throttling: reject only adhoc queries #6947
Conversation
5e39a8b
to
53cedc7
Compare
53cedc7
to
47da956
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
pkg/ingester/ingester.go
Outdated
@@ -2262,7 +2263,7 @@ func (i *Ingester) trackInflightQueryRequest() (func(), error) { | |||
|
|||
i.maxInflightQueryRequests.Track(i.inflightQueryRequests.Inc()) | |||
|
|||
if i.resourceBasedLimiter != nil { | |||
if i.resourceBasedLimiter != nil && requestmeta.RequestSourceFromContext(ctx) == requestmeta.SourceApi { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: what do you think of adding helper functions in requestmeta itself? ie. requestmeta.RequestFromApi(ctx)
and requestmeta.RequestFromRuler(ctx)
Signed-off-by: Erlan Zholdubai uulu <[email protected]>
47da956
to
8bb3d4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you
const ( | ||
SourceApi = "api" | ||
SourceRuler = "ruler" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about reusing tripperware.SourceAPI
and tripperware.SourceRuler
?
What this PR does:
Exclude rules queries from resource-based query rejection
Description:
This change improves the resource-based query rejection mechanism by ensuring that only ad-hoc API queries are rejected when resource thresholds are breached. Queries originating from rule evaluations are now excluded from rejection.
Introduced RequestSource metadata to distinguish between API and ruler queries.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]