-
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
Adding store selector for querier #6122
Conversation
f21b129
to
74db747
Compare
104f576
to
d5605ab
Compare
850d7aa
to
bcb38db
Compare
Can we apply the same relabeing in the endpointset so that we get a correct view on the Stores page? |
Adding Store selector in thanos querier based on [proposal](https://github.com/thanos-io/thanos/blob/main/docs/proposals-accepted/202301-distributed-query-execution.md#distributed-execution-against-receive-components). This PR will add new flag --selector.relabel-config which will allow queriers to apply relabel rules agents Stores external label set and decide whether to keep or drop a TSDB from the query path. Signed-off-by: Sharad Gaur <sharadgaur@gmail.com> Co-authored-by: Filip Petkovski <filip.petkovsky@gmail.com>
Signed-off-by: Sharad <sharadgaur@gmail.com>
Signed-off-by: Sharad <sharadgaur@gmail.com>
a8223a5
to
e877ca0
Compare
Signed-off-by: Sharad <sharadgaur@gmail.com>
4691312
to
0572553
Compare
Signed-off-by: Sharad <sharadgaur@gmail.com>
65a47e8
to
2e10c67
Compare
pkg/query/endpointset.go
Outdated
for _, v := range e.endpoints { | ||
status := v.getStatus() | ||
if status != nil { | ||
if e.storeSelector.RelabelConfigEnabled() { |
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 make this implicit inside MatchStore
. We can check if relabelConfig
is nil and return true
in that case.
pkg/query/endpointset_test.go
Outdated
// Initial update. | ||
endpointSet.Update(context.Background()) | ||
testutil.Equals(t, 3, len(endpointSet.endpoints)) | ||
testutil.Equals(t, 3, len(endpointSet.GetStoreClients())) |
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.
Hm, shouldn't this also be 2? I suggest we move the filtering logic in the EndpointSet.Update
method, after line 398. We can filter out all newRefs
and existingRefs
refs that do not match the selector so that they're not added as endpoints in the first place.
Signed-off-by: Sharad <sharadgaur@gmail.com>
@@ -389,7 +395,20 @@ func (e *EndpointSet) Update(ctx context.Context) { | |||
newRef.Close() | |||
return | |||
} | |||
if len(newRef.labelSets()) > 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.
Looks like its possible to have empty 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.
Won't this preserve endpoints with empty labels sets even if the selector has a relabel with keep
?
pkg/store/store_selector.go
Outdated
} | ||
|
||
func (sr *StoreSelector) MatchStore(labelSets ...labels.Labels) (bool, []labels.Labels) { | ||
if sr.relabelConfig == nil { |
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 we can return true if relabelConfig == nil or len(labelSets) ==0
Signed-off-by: Sharad <sharadgaur@gmail.com>
Hello 👋 Looks like there was no activity on this amazing PR for the last 30 days. |
Closing for now as promised, let us know if you need this to be reopened! 🤗 |
Changes
Adding Store selector in thanos querier based on proposal.
This PR will add new flag --selector.relabel-config which will allow queriers to apply relabel rules against Stores external label set and decide whether to keep or drop a TSDB from the query path.
Verification