-
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
cmd/thanos/query: add initial rules support #2240
Conversation
0fe7863
to
2a7ef1b
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.
Nice!
Some thoughts, but generally looks amazing. What about changing Rules API and add some Info endpoint?
e701735
to
ba2911a
Compare
d936dcc
to
07a96e2
Compare
6bb7d5d
to
57ea1bf
Compare
63f2a14
to
2925c8c
Compare
cmd/thanos/query.go
Outdated
@@ -76,6 +76,9 @@ func registerQuery(m map[string]setupFunc, app *kingpin.Application) { | |||
stores := cmd.Flag("store", "Addresses of statically configured store API servers (repeatable). The scheme may be prefixed with 'dns+' or 'dnssrv+' to detect store API servers through respective DNS lookups."). | |||
PlaceHolder("<store>").Strings() | |||
|
|||
rules := cmd.Flag("rule", "Addresses of statically configured rules API servers (repeatable). The scheme may be prefixed with 'dns+' or 'dnssrv+' to detect store API servers through respective DNS lookups."). |
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.
We might want to be clear that Rules API has to implement Info as well to work
6de6e54
to
e8bc4de
Compare
Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
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.
Looks good for now!
Let's merge. 🎉
Just note to @povilasv and @GiedriusS this merge to release branch for now (: Just to not get confused.
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 found some problems with the proxying stuff :P I understand that you are only pushing into a feature branch but I think it's worth fixing these problems early. Awesome work! Can't wait to use this when it will be fully finished.
if err := rr.proxy.Rules(&storepb.RulesRequest{ | ||
PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, | ||
}, resp); err != nil { | ||
return nil, nil, errors.Wrap(err, "proxy RuleGroups()") |
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.
consider not captilazing error strings https://github.com/golang/go/wiki/CodeReviewComments#error-strings
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.
hmm ... I wanted to stay consistent with
Line 208 in 4240e3c
return nil, nil, errors.Wrap(err, "proxy Series()") |
wdyt?
resp := &rulesServer{ctx: ctx} | ||
|
||
if err := rr.proxy.Rules(&storepb.RulesRequest{ | ||
PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, |
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 should be configureable, no?
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 👍 I was just impatient and wanted to have something working :)
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.
plus (note to myself): once I have also configurability injected here, this is where I want to implement the deduplication, and of course it needs unit tests here too.
@GiedriusS @povilasv please bear with me, it is still WIP :-) I'll ping once I remove the tag, thanks for the early feedback!!! ❤️ |
Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
@GiedriusS @povilasv @bwplotka I added an initial (very simple) e2e test, spinning up a Thanos Querier + Sidecar (so far the two components implementing the API). So far no deduplication logic yet, bear with me :-) Also ... a general neutral statement from someone contributing the first time: I really really enjoy the code base and the great e2e testing framework capabilities here, so much goodness here and easy to start locally ❤️ |
Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
@GiedriusS @povilasv @bwplotka Do you believe we could merge this into the feature branch? It would make logistics easier for me to submit additional PRs for the actual deduplication which I am working on right now. Thank you! :-) |
Let's go! 💪 We can address potential comments in next PRs! |
AFAIK all comments by @povilasv and @GiedriusS were fixed. |
* cmd/thanos/query: add initial rules support Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * pkg/query/api/v1: initial implementation Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * e2e: initial implementation and fixes Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * pkg/query: fix racy access to assert rules API store Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
) * Added RulesAPI. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Added warnings. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Added Type to rules requests as it is on HTTP API. (#2201) Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * pkg/store/storepb: fix wrong rule reference (#2237) * pkg/store/storepb: fix wrong rule reference Currently we recursively reference rules instead of recording rules. Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * proto: regenerate Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * Made storepb.RuleGroups a source of truth for rules API (Go, JSON, proto). Added tests. (#2242) Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Use proto rules API instead of struct; Moved as much as possible to promclient; Added rulesAPI RPC to sidecar. (#2243) * Use proto rules API instead of struct; Added rulesAPI RPC to sidecar. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Fixed broken test. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Use proto rules API instead of struct; Moved as much as possible to promclient; Added rulesAPI RPC to sidecar. (#2291) * rules_custom_test: fix asserting labels Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * TestPrometheusStore_Rules_e2e: fix test fixture Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> Co-authored-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * cmd/thanos/query: add initial rules support (#2240) * cmd/thanos/query: add initial rules support Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * pkg/query/api/v1: initial implementation Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * e2e: initial implementation and fixes Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * pkg/query: fix racy access to assert rules API store Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com> * Refactored proto generation and separated store from rules APIs. (#2558) * Refactored proto generation and separate store from rules APIs. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Addressed comments. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Fixed proto gen. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Addressed Serg comments. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Added Ruler support for RulesAPI; Refactored Manager. (#2562) As per: https://thanos.io/proposals/202003_thanos_rules_federation.md/ Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Small fixes to changelog and flags. Do not add any. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> * Fixed after rebase. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> Co-authored-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
This adds basic support for the rule parameter into the Thanos Query component. Marking as WIP as I'd like to have feedback about whether the trajectory actually is fit.
Bear with me, I am new here :-)
cc @bwplotka