-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
query-frontend: Fix cache keys for dynamic split intervals #7832
query-frontend: Fix cache keys for dynamic split intervals #7832
Conversation
e2e run locally after a few retries |
9355e26
to
f808233
Compare
pkg/queryfrontend/cache.go
Outdated
} | ||
return fmt.Sprintf("fe:%s:%s:%d:%d", userID, r.GetQuery(), r.GetStep(), currentInterval) | ||
|
||
return "request_type_not_supported" |
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.
This is a condition that we should never hit in prod, right? Perhaps we should just panic()
here?
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.
replaced
pkg/queryfrontend/cache.go
Outdated
switch tr := r.(type) { | ||
case *ThanosQueryRangeRequest: | ||
i := 0 | ||
for ; i < len(t.resolutions) && t.resolutions[i] > tr.MaxSourceResolution; i++ { | ||
} | ||
shardInfoKey := generateShardInfoKey(tr) | ||
return fmt.Sprintf("fe:%s:%s:%d:%d:%d:%s:%d:%s", userID, tr.Query, tr.Step, currentInterval, i, shardInfoKey, tr.LookbackDelta, tr.Engine) | ||
splitInterval := tr.SplitInterval.Milliseconds() |
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.
I wonder if it's possible to write a function for these splitInterval/currentInterval calculations instead of copy/paste
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.
Refactored.
86930d4
to
6554d24
Compare
@pedro-stanaka maybe you'd like to voice your opinion here |
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.
Make sense to me. Thanks for the fix
|
I think you need to rebase on top of latest main to get the github actions changes |
Head branch was pushed to by a user without write access
Signed-off-by: Michał Mazur <mmazur.box@gmail.com>
Signed-off-by: Michał Mazur <mmazur.box@gmail.com>
Signed-off-by: Michał Mazur <mmazur.box@gmail.com>
f30035d
to
d4725c3
Compare
@yeya24 Rebased without any new change. |
Changes
The same interval is used for query splitting and cache key generation (the split interval is stored in requests created during the split).
Split interval has been added to cache keys to avoid overlaps for queries based on different intervals.
Support for caching generic PrometheusRequest has been removed - already PrometheusRequest was not been created by any configured decoder.
Verification
Run local tests
make test
, run query-frontend on a test environment.