-
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
*: Allow exposing multiple label-sets #1284
Conversation
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.
Definetely add changelog entry as this breaks our interface. labels -> labelsets in InfoResponse proto.
Would be amazing to see more docs, explaining how the store matching works, does store has too much all the labelsets only one, etc? Potential use cases.
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.
Initial review (did not finish yet). Overall LGTM, some suggestions so far (:
Will continue later.
s.mtx.RLock() | ||
defer s.mtx.RUnlock() | ||
func (s *storeRef) Update(labelSets []storepb.LabelSet, minTime int64, maxTime int64) { | ||
s.mtx.Lock() |
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 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 think there might be 2 major things to improve (let me know if I am wrong):
- matching is quite odd, is
AND
intended? - I don't think we need fanout on
Info
@@ -193,7 +266,7 @@ func (s *ProxyStore) Series(r *storepb.SeriesRequest, srv storepb.Store_SeriesSe | |||
|
|||
sc, err := st.Series(seriesCtx, r) | |||
if err != nil { | |||
storeID := fmt.Sprintf("%v", storepb.LabelsToString(st.Labels())) | |||
storeID := storepb.LabelSetsToString(st.LabelSets()) |
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.
👍
e900615
to
c447905
Compare
I believe I have addressed all comments and rebased the branch to resolve conflicts with master. Let me know what you think 🙂 . Overall this is in a much better shape than the first time around I think! I'm feeling much more comfortable with it now. Thanks for the reviews! |
CHANGELOG.md
Outdated
@@ -19,6 +19,8 @@ We use *breaking* word for marking changes that are not backward compatible (rel | |||
|
|||
- [#1248](https://github.com/improbable-eng/thanos/pull/1248) Add a web UI to show the state of remote storage. | |||
|
|||
- [#1284](https://github.com/improbable-eng/thanos/pull/1284) Add support for multiple label-sets in Info gRPC service. This deprecates the single `Labels` slice of the `InfoResponse`. |
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 mention maybe what's the plan on deprecation. It looks like breaking change, while it is not. Worth to add details on that otherwise users will be like Ok, but then all the components has to be upgraded to 0.6.0 if I use 0.6.0 Querier
?
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, just very minor nits.
Thanks!
stores := s.stores() | ||
|
||
if len(stores) == 0 { | ||
res.MaxTime = math.MaxInt64 |
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 am not sure about this. I know there is not regression to previous version (same logic), but does this make sense? ;p
Let's leave the comment maybe? // Edge case: we have all of the data if there are no stores.
and add some TODO
.
Essentially not sure if we no store we should do either
- max time = MaxInt64 and min time = maxInt64 as nothing is there.
or - max time = MaxInt64 and min Time MinInt64 if we want to have
whole range
;p
But we should not spend time on this in this PR I guess.
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.
Would an issue be more appropriate than a TODO in code maybe?
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'm adding the "Edge case:" comment back and will open an issue to decide this as a follow up.
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, makes sense
res.MaxTime = MaxTime | ||
res.MinTime = MinTime | ||
res.MaxTime = maxTime | ||
res.MinTime = minTime | ||
|
||
for _, l := range s.selectorLabels { |
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 assume we are not removing selector Labels
for now?
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.
It somewhat depends on our decision around the changelog. If we decide all queriers must be >=v0.6.0 if any are, then this would be safe to remove.
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 leave for now
|
||
res.LabelSets = make([]storepb.LabelSet, 0, len(labelSets)) | ||
for _, v := range labelSets { | ||
res.LabelSets = append(res.LabelSets, storepb.LabelSet{Labels: v}) |
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.
Worth to mention on interface that sets are not sorted?
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.
Added to the proto message and generated structs.
This is used for backward compatibility of the querier with store APIs that don't expose LabelSet yet.
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 just one suggestion more - hopefully last one (:
pkg/query/storeset.go
Outdated
@@ -32,14 +33,14 @@ type StoreSpec interface { | |||
// If metadata call fails we assume that store is no longer accessible and we should not use it. | |||
// NOTE: It is implementation responsibility to retry until context timeout, but a caller responsibility to manage | |||
// given store connection. | |||
Metadata(ctx context.Context, client storepb.StoreClient) (labels []storepb.Label, mint int64, maxt int64, err error) | |||
Metadata(ctx context.Context, client storepb.StoreClient) (labelSets []storepb.LabelSet, labels []storepb.Label, mint int64, maxt int64, err error) |
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 don't really get why not just replacing with labelSets.
We can hide the compatibility logic internally, right?
pkg/query/storeset.go
Outdated
s.mtx.RLock() | ||
defer s.mtx.RUnlock() | ||
func (s *storeRef) Update(labelSets []storepb.LabelSet, labels []storepb.Label, minTime int64, maxTime int64) { | ||
if len(labelSets) == 0 && len(labels) > 0 { |
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 would hide it behind Metadata interface.
stores := s.stores() | ||
|
||
if len(stores) == 0 { | ||
res.MaxTime = math.MaxInt64 |
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, makes sense
res.MaxTime = MaxTime | ||
res.MinTime = MinTime | ||
res.MaxTime = maxTime | ||
res.MinTime = minTime | ||
|
||
for _, l := range s.selectorLabels { |
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 leave for now
Awesome! 🚢 it. Thanks 👍 |
Changes
This PR adds that the Info gRPC service now exposes potentially multiple label-sets. For all store types except
proxy
this doesn't change anything for now, it just adds the currently single label-set as the only entry in the list of label-sets. Theproxy
type, from now exposes it's stores' labels merged with its configured selector.I'd like to ask that the
proxy.go
changes are particularly carefully reviewed.Verification
Adapted all tests and see them passing.
@squat @bwplotka @GiedriusS @povilasv @domgreen