-
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
storeApi: add component information to gRPC's Info response (resolves #739) #750
storeApi: add component information to gRPC's Info response (resolves #739) #750
Conversation
Greetings everyone 👋 Before I go further on this PR, let me know if I take the right approach. I limited myself to active components, dunno if it's worth it to have some kind of Also not an expert in Protobuf. And that multi-interface thing in Cheers 🎉 |
BTW, which UI version do you prefer ? |
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.
Thanks a lot!
You were sceptical of this component desing on previous description. Are you sold now or do you have specific objections? (: I feel it kind of fits well.
Overall I like the direction! LGTM. Some suggestions.
Thanks for 2 different options. I really like both.. But B) might be more readable (:
I've completed every components for now ! I went with Option B. Here are some screenshots: One thing I'd like some input is this bit: https://github.com/Cdiscount/thanos/blob/767eaaaeb59f72dc2b705386627a8c8948a31452/pkg/query/storeset.go#L312 I initially went with updating the Things left to do:
|
Awesome, can we remove |
Also some minor rebase would be nice. |
"github.com/improbable-eng/thanos/pkg/store/storepb" | ||
) | ||
|
||
type StoreAPI interface { |
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.
Go wants comments like this for exported functions:
type StoreAPI interface { | |
// StoreAPI is ... | |
type StoreAPI interface { |
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.
Exaclty this ^
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.
Code looks good to me. I like the option B you went with. Thanks for taking care of this! 👍
That was some rebase from hell ! I'm pretty happy with how it looks 😄 Hope to add some more UI niceties soon ! |
pkg/store/bucket_test.go
Outdated
dir, err := ioutil.TempDir("", "prometheus-test") | ||
testutil.Ok(t, err) | ||
|
||
// TODO: might be worth creating a `testutil.NewBucketStore()` |
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 haven't actually executed this code but LGTM. Except for this comment - what do you mean by this? What would it do?
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.
A bit like https://github.com/improbable-eng/thanos/blob/00619585c5dc3d0ce2275a8864e3b666d8375acc/pkg/testutil/prometheus.go#L76 to create a test instance.
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.
Well the only benefit would be to use shorter function instead of (single line anyway) NewBucketStore(nil, nil, nil, dir, 2e5, 2e5, false, 20)
.
Let's remove this comment and go with what it is 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.
LGTM 👍 I totally like option B. Thanks a lot!
Errrr, I messed up the latest merge 😕 Will fix this later today. |
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 and thanks!
Some nits related to commentary and formatting.
There is one potential to use embedding interfaces, not sure why you replicate method
but we might have diamond problem: https://joaodlf.com/go-the-diamond-problem.html but I think we can go with this as well 👍
cmd/thanos/rule.go
Outdated
@@ -522,7 +523,7 @@ func runRule( | |||
} | |||
logger := log.With(logger, "component", "store") |
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.
Let's fix this and put proper type here as well (:
cmd/thanos/rule.go
Outdated
@@ -193,7 +194,7 @@ func runRule( | |||
peer cluster.Peer, | |||
objStoreConfig *pathOrContent, | |||
tsdbOpts *tsdb.Options, | |||
component string, | |||
component component.SourceStoreAPI, |
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.
There is no point for this argument... Let's just put use constant everywhere (:
@@ -77,7 +78,7 @@ func registerSidecar(m map[string]setupFunc, app *kingpin.Application, name stri | |||
objStoreConfig, | |||
peer, | |||
rl, | |||
name, |
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.
Same here - let's just put constant in place everywhere in sidecar - no point to dynamically eval this variable
pkg/component/component.go
Outdated
"github.com/improbable-eng/thanos/pkg/store/storepb" | ||
) | ||
|
||
// Component that implements gRPC StoreApi |
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.
So in Golang for public structs and methods needs to start with method or struct name (:
So here would be StoreAPI is an component that...
(:
Not sure if it is written anywhere, but essentially golint (go get -u golang.org/x/lint/golint && golint ./pkg/component/....
) will show you the guidance there. It is super strict and sometimes annoying so we don't use it in CI but for those struct and method comments it makes sense, so can we adjust comments in this file in this way? (:
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.
And missing trailing period for all comments here (:
"github.com/improbable-eng/thanos/pkg/store/storepb" | ||
) | ||
|
||
type StoreAPI interface { |
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.
Exaclty this ^
// Component that implements gRPC StoreApi and produce blocks of metrics | ||
type SourceStoreAPI interface { | ||
implementsStoreAPI() | ||
producesBlocks() |
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.
Again, we could use embedding here. For example:
type SourceStoreAPI interface {
Source
StoreAPI
}
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.
But I guess it will cause diamond problem as described here: https://joaodlf.com/go-the-diamond-problem.html
(with String()
) - that's fine then - let's leave your version as it is.
pkg/store/storepb/rpc.proto
Outdated
message InfoResponse { | ||
repeated Label labels = 1 [(gogoproto.nullable) = false]; | ||
int64 min_time = 2; | ||
int64 max_time = 3; | ||
StoreType storeType = 4; |
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, just formatting is off
pkg/store/bucket_test.go
Outdated
dir, err := ioutil.TempDir("", "prometheus-test") | ||
testutil.Ok(t, err) | ||
|
||
// TODO: might be worth creating a `testutil.NewBucketStore()` |
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.
Well the only benefit would be to use shorter function instead of (single line anyway) NewBucketStore(nil, nil, nil, dir, 2e5, 2e5, false, 20)
.
Let's remove this comment and go with what it is here 👍
Signed-off-by: Adrien Fillon <[email protected]>
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 this! Now we need to think about something to fix that: #748 |
Signed-off-by: Adrien Fillon [email protected]
This PR aims to resolve #739.
Changes
*: Adds a set of enums for each components of Thanos
storeAPI: Adds a component field to Info's response
Verification