-
Notifications
You must be signed in to change notification settings - Fork 816
Support Ruler to query Query Frontend #6151
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
Support Ruler to query Query Frontend #6151
Conversation
cec96af
to
4d42fcf
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.
Instead of making Query Frontend a queryable, I think I prefer changing the engine query function https://github.com/cortexproject/cortex/blob/master/pkg/ruler/compat.go#L206.
Instead of using a local engine, we use a remote query frontend to evaluate the query results.
7ff9818
to
84d16b4
Compare
@yeya24 |
pkg/ruler/compat.go
Outdated
@@ -226,6 +226,33 @@ func EngineQueryFunc(engine promql.QueryEngine, q storage.Queryable, overrides R | |||
} | |||
} | |||
|
|||
func QueryFrontendQueryFunc(promClient *promClient, overrides RulesLimits, userID string, lookbackDelta time.Duration) rules.QueryFunc { |
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.
Can we reuse the existing EngineQueryFunc
function?
d579b4b
to
062885e
Compare
@yeya24 |
062885e
to
aba8591
Compare
@yeya24 |
We are in the process of releasing 1.18 |
c78a066
to
35f8879
Compare
@yeya24
|
Make sense. I am thinking about the same thing. Query frontend already supports grpc as long as you wrap your request with httpgrpc. We don't need to define a new rpc in cortex.pb For the protobuf change, we don't need to do it in this PR. |
@yeya24 |
@SungJin1212 This is how query frontend converts a http request to httpgrpc request https://github.com/cortexproject/cortex/blob/master/pkg/frontend/transport/roundtripper.go#L39. We can do something similar. But from Ruler to Query Frontend. |
248c350
to
f1e2a3d
Compare
@yeya24 |
006b710
to
0324695
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.
@SungJin1212 Thanks for the great work! I think this feature looks really solid now.
We can give it a try.
I think we also lack of some documentation but it is fine to do it in another PR.
0324695
to
bb300a5
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.
I have no concerns. Only small nits:
-
Mark it as experimental on:
https://cortexmetrics.io/docs/configuration/v1guarantees/#experimental-features -
Architecture diagram needs update
https://cortexmetrics.io/docs/architecture/ -
Why is it better? I can see frontend caching is one is reason.
You could add some a guide page similar to
https://cortexmetrics.io/docs/guides/ruler-sharding/
@SungJin1212 As @friedrichg said, let's mark this feature as experimental in cortexmetrics.io/docs/configuration/v1guarantees#experimental-features.
I think we can skip this in this pr. We need to update it anyway.
We will add a doc but will create another issue to track that. This item doesn't need to be owned by @SungJin1212 |
bb300a5
to
2d88c97
Compare
@yeya24 @friedrichg |
|
||
# Timeout for downstream rulers. | ||
# CLI flag: -ruler.frontendClient.remote-timeout | ||
[remote_timeout: <duration> | default = 2m] |
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's this flag for? This seems not used. I wonder if we should consolidate this flag with frontend timeout as they seem to do the same thing.
However, the flag description seems hardcoded to Timeout for downstream rulers.
.
pkg/ruler/frontend_client_pool.go
Outdated
type frontendPool struct { | ||
timeout time.Duration | ||
prometheusHTTPPrefix string | ||
grpcConfig ClientConfig |
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 we should use grpcclient.Config
instead?
ClientConfig
seems used for Ruler to talk to each other only
@yeya24 |
2d88c97
to
3a74a24
Compare
Signed-off-by: SungJin1212 <[email protected]>
3a74a24
to
83db99d
Compare
@friedrichg |
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
Thanks for the contribution! |
What this PR does:
Add
ruler.frontend-address
to allow query to query frontends instead of ingesters. If-ruler.frontend-address
is set, rulers query to query frontends for evaluating rules. It can support query frontend features like vertical query sharding.Which issue(s) this PR fixes:
Fixes #5105
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]