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

Refactored proto generation and separated store from rules APIs. #2558

Merged
merged 4 commits into from
May 20, 2020

Conversation

bwplotka
Copy link
Member

@bwplotka bwplotka commented May 4, 2020

Just refactor, no logic was changed.

NOTE: This is major change to how we build our photos (: ( I think good one, thanks for this we can import and reuse things, while maintaining different Go packages.

cc @s-urbaniak
Signed-off-by: Bartlomiej Plotka bwplotka@gmail.com

@s-urbaniak
Copy link
Contributor

lgtm 👍

@bwplotka bwplotka force-pushed the ruler branch 4 times, most recently from fc08fdc to 23b9d02 Compare May 4, 2020 16:07
@bwplotka
Copy link
Member Author

bwplotka commented May 4, 2020

With this we separated rules and store APIs and servers into different directories 🤗

image

@bwplotka
Copy link
Member Author

bwplotka commented May 4, 2020

Giving time for others to review this. @s-urbaniak let's build up on top of this PR (:

@bwplotka bwplotka requested a review from kakkoyun May 5, 2020 07:55
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.

Some suggestions on how to improve this but overall good work 👍 thanks!

pkg/promclient/promclient.go Outdated Show resolved Hide resolved
pkg/query/storeset.go Outdated Show resolved Hide resolved
srv := &rulesServer{ctx: ctx}
err = promRules.Rules(&rulespb.RulesRequest{}, srv)
if tcase.expectedErr != nil {
testutil.NotOk(t, err)
Copy link
Member

Choose a reason for hiding this comment

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

Minor thing but this is unnecessary since we check for equality on the next line and tcase.expectedErr is guaranteed not to be nil. BTW, great test 😄

pkg/rules/proxy.go Show resolved Hide resolved
pkg/rules/proxy.go Outdated Show resolved Hide resolved
pkg/rules/proxy_test.go Outdated Show resolved Hide resolved
bwplotka added 2 commits May 20, 2020 09:26
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
@bwplotka
Copy link
Member Author

All addressed and rebased, please PTAL @s-urbaniak

@bwplotka bwplotka force-pushed the ruler branch 2 times, most recently from 26e40f2 to 3318116 Compare May 20, 2020 09:29
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
cmd/thanos/rule.go Outdated Show resolved Hide resolved
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
@bwplotka
Copy link
Member Author

done @s-urbaniak

@@ -1,7 +1,7 @@
// Copyright (c) The Thanos Authors.
// Licensed under the Apache License 2.0.

package thanosrule
package manager
Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if we can name this more concrete. This implementation "manages" rule files, correct? Maybe even rules/file makes more sense here then? The struct file.Manager could stay, stating that it is "managing" those rule files.

Copy link
Member Author

@bwplotka bwplotka May 20, 2020

Choose a reason for hiding this comment

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

maybe but TBH it's mainly a manager that groups Prom ones.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good then

Copy link
Member Author

Choose a reason for hiding this comment

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

actually we change this in next PR ;p so let's merge

@s-urbaniak
Copy link
Contributor

just naming nits, else lgtm 👍

@bwplotka bwplotka merged commit b5001c9 into features/rules-proxy May 20, 2020
@bwplotka bwplotka deleted the ruler branch May 20, 2020 10:30
bwplotka added a commit that referenced this pull request May 22, 2020
* 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>
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.

3 participants