Skip to content
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

Merged
merged 4 commits into from
May 4, 2020

Conversation

s-urbaniak
Copy link
Contributor

@s-urbaniak s-urbaniak commented Mar 9, 2020

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

@s-urbaniak s-urbaniak changed the title cmd/thanos/query: add initial rules support [WIP] cmd/thanos/query: add initial rules support Mar 9, 2020
@s-urbaniak s-urbaniak force-pushed the rule branch 5 times, most recently from 0fe7863 to 2a7ef1b Compare March 9, 2020 18:49
Copy link
Member

@bwplotka bwplotka left a 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?

@s-urbaniak s-urbaniak force-pushed the rule branch 2 times, most recently from e701735 to ba2911a Compare March 19, 2020 12:38
@s-urbaniak s-urbaniak force-pushed the rule branch 3 times, most recently from d936dcc to 07a96e2 Compare March 30, 2020 13:22
@s-urbaniak s-urbaniak force-pushed the rule branch 7 times, most recently from 6bb7d5d to 57ea1bf Compare April 7, 2020 15:06
@s-urbaniak s-urbaniak force-pushed the rule branch 5 times, most recently from 63f2a14 to 2925c8c Compare April 21, 2020 12:57
@bwplotka bwplotka changed the title [WIP] cmd/thanos/query: add initial rules support cmd/thanos/query: add initial rules support Apr 22, 2020
@@ -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.").
Copy link
Member

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

@s-urbaniak s-urbaniak force-pushed the rule branch 4 times, most recently from 6de6e54 to e8bc4de Compare April 27, 2020 14:07
Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
Copy link
Member

@bwplotka bwplotka left a 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.

Copy link
Member

@GiedriusS GiedriusS left a 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()")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

return nil, nil, errors.Wrap(err, "proxy Series()")

wdyt?

resp := &rulesServer{ctx: ctx}

if err := rr.proxy.Rules(&storepb.RulesRequest{
PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT,
Copy link
Member

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?

Copy link
Contributor Author

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 :)

Copy link
Contributor Author

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.

@s-urbaniak
Copy link
Contributor Author

@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>
@s-urbaniak
Copy link
Contributor Author

@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>
@s-urbaniak
Copy link
Contributor Author

@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! :-)

@bwplotka bwplotka merged commit 705d7cf into thanos-io:features/rules-proxy May 4, 2020
@bwplotka
Copy link
Member

bwplotka commented May 4, 2020

Let's go! 💪

We can address potential comments in next PRs!

@bwplotka
Copy link
Member

bwplotka commented May 4, 2020

AFAIK all comments by @povilasv and @GiedriusS were fixed.

@s-urbaniak s-urbaniak deleted the rule branch May 4, 2020 09:21
bwplotka pushed a commit that referenced this pull request May 22, 2020
* 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>
brancz pushed a commit that referenced this pull request May 25, 2020
)

* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants