Query-frontend: add -query-frontend.query-sharding-max-regexp-size-bytes #4632
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
Query sharding amplifies the number of partial queries executed by queriers, and so label matchers evaluated by ingesters and store-gateway. We've seen some edge cases where very complex regexp can spike the ingesters CPU significantly, up to the point of saturating the node CPU. Despite our efforts to optimise the regexp matcher (which in many cases are very effective), I would like to add an optional limit to query sharding, to skip it if the query contains a regexp longer than the configured limit.
Note to reviewers:
TestQuerySharding_ShouldFallbackToDownstreamHandlerOnMappingFailure
beacuse it expects to push down to queriers a query we can't parse, which is not correct (there's no point doing it). The test aims toensure we push down to querier a query we fail to shard (but we can parse), but this can happen only in case of logic bugs in the query sharding, and so can't be reproduced unless mocking its internals. I tried to mock the internals to reproduce it, but the resulting code is pretty ugly, so I'm proposing to just get rid of that test.
Which issue(s) this PR fixes or relates to
N/A
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]