-
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
Cache labels and series results #3315
Conversation
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 looks amazing ❤️
Some high-level comments, but overall LGTM! (:
case *ThanosLabelsRequest: | ||
return fmt.Sprintf("%s:%d", tr.Label, currentInterval) | ||
case *ThanosSeriesRequest: | ||
return fmt.Sprintf("%s:%d", tr.Matchers, currentInterval) | ||
} | ||
return fmt.Sprintf("%s:%d:%d", r.GetQuery(), r.GetStep(), currentInterval) |
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.
Shouldn't we error 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.
I am not sure but this shouldn't happen. It would error out in the first place when decoding the HTTP request if the request is not valid.
CHANGELOG.md
Outdated
@@ -13,6 +13,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re | |||
|
|||
- [#3261](https://github.com/thanos-io/thanos/pull/3261) Thanos Store: Use segment files specified in meta.json file, if present. If not present, Store does the LIST operation as before. | |||
- [#3276](https://github.com/thanos-io/thanos/pull/3276) Query Frontend: Support query splitting and retry for labels and series requests. | |||
- [#3315](https://github.com/thanos-io/thanos/pull/3315) Query Frontend: Support results caching for labels and series requests. |
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.
label names ? label values? both?
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.
Yes both. I will make it more clear.
i := 0 | ||
for ; i < len(t.resolutions) && t.resolutions[i] > tr.MaxSourceResolution; i++ { | ||
} | ||
return fmt.Sprintf("%s:%d:%d:%d", tr.Query, tr.Step, currentInterval, i) | ||
case *ThanosLabelsRequest: |
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.
What about label names?
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.
ThanosLabelsRequest
already covers both label_values
query and label_names
query. If it is a label_names
query, then tr.Label
is just an empty string. For label_values
query, that's the queried label name.
I am using the same struct for them since their query response is the same []string
// GetStep returns the step of the request in milliseconds. | ||
func (r *ThanosLabelsRequest) GetStep() int64 { return 0 } | ||
// GetStep returns the step of the request in milliseconds. Returns 1 is a trick to avoid panic in | ||
// https://github.com/cortexproject/cortex/blob/master/pkg/querier/queryrange/results_cache.go#L447. |
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.
(: Yea it's getting very tricky without Cortex actually support our case, and it would be nice to help them as well 🤔
This is fine for now, but wonder how long term solution of truly shared code with cortex would looks like
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.
Yeah, I will take a look later. Would be good to have these query APIs natively supported on Cortex then we can re-use.
Signed-off-by: Ben Ye <[email protected]>
Signed-off-by: Ben Ye <[email protected]>
Signed-off-by: Ben Ye <[email protected]>
Signed-off-by: Ben Ye <[email protected]>
Signed-off-by: Ben Ye <[email protected]>
97eb6cd
to
651b1bd
Compare
Conflict fixed. Please give another round of review if you have time. |
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. Great work. I think we can go ahead and merge it. We can open follow up PRs if needed.
Signed-off-by: Ben Ye [email protected]
Changes
Fixes #3230
Verification