-
Notifications
You must be signed in to change notification settings - Fork 812
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
Enforce "max chunks per query" limit in ingesters too #4125
Enforce "max chunks per query" limit in ingesters too #4125
Conversation
bbb1323
to
2cd47a1
Compare
Can you please rebase against master to pull in #4137 and move the changelog entry to the top? |
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.
Good job, nothing to complain about. :)
pkg/distributor/query.go
Outdated
func (d *Distributor) queryIngesterStream(ctx context.Context, userID string, replicationSet ring.ReplicationSet, req *ingester_client.QueryRequest) (*ingester_client.QueryStreamResponse, error) { | ||
var ( | ||
maxChunksLimit = d.limits.MaxChunksPerQueryFromIngesters(userID) | ||
totChunksCount = atomic.Int32{} |
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.
total? :) if you shorten both (chunksLimit
, chunksCount
) they will align nicely, and are expressive enough.
labels.MustNewMatcher(labels.MatchEqual, "foo", "bar"), | ||
labels.MustNewMatcher(labels.MatchNotEqual, "who", "boh"), | ||
}, | ||
expected: `{foo="bar",who!="boh"}`, |
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.
Test with __name__
label name would show that no special handling of that name is done.
…ier.max-fetched-chunks-per-query which is applied both to ingesters and long-term storage Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
31815c5
to
a7e3cc8
Compare
Thanks @pstibrany, I've addressed your feedback! |
What this PR does:
The
-store.query-chunk-limit
is only enforced in the long-term storage (but not ingesters). However, there are cases where this limit can actually be hit just querying ingesters, so I would like to apply the limit when fetching chunks from ingesters too.However, if we extend
-store.query-chunk-limit
to apply to ingesters too, that could be considered a breaking change, so in this PR I'm proposing to deprecate-store.query-chunk-limit
in favour of a new config option-querier.max-fetched-chunks-per-query
, whose limit is applied both to ingesters and long-term storage.Due to how the querying works in Cortex (ingesters and long-terms storage are queried separately) in this PR I'm proposing to keep it simple and apply the limit independently to ingesters and storage. This means that the total number of actual fetched chunks could be 2x the limit, being independently applied when querying ingesters and long-term storage. If accepted, this is something we may get back and eventually improve (in my opinion having the limit applied to ingesters too is better than having a true global limit, considering ingesters are currently unbounded, but I'm open to feedback).
Which issue(s) this PR fixes:
N/A
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]