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

Adding store selector for querier #6122

Closed

Conversation

sharadgaur
Copy link

@sharadgaur sharadgaur commented Feb 14, 2023

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

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

@sharadgaur sharadgaur force-pushed the querier_store_selector_1 branch 3 times, most recently from f21b129 to 74db747 Compare February 14, 2023 00:26
@sharadgaur sharadgaur marked this pull request as ready for review February 14, 2023 00:53
@sharadgaur sharadgaur force-pushed the querier_store_selector_1 branch 2 times, most recently from 104f576 to d5605ab Compare February 14, 2023 14:28
@sharadgaur sharadgaur force-pushed the querier_store_selector_1 branch 2 times, most recently from 850d7aa to bcb38db Compare February 16, 2023 15:34
@fpetkovski
Copy link
Contributor

Can we apply the same relabeing in the endpointset so that we get a correct view on the Stores page?

sharadgaur and others added 3 commits February 21, 2023 13:36
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>
@sharadgaur sharadgaur marked this pull request as draft February 21, 2023 18:53
Signed-off-by: Sharad <sharadgaur@gmail.com>
@sharadgaur sharadgaur marked this pull request as ready for review February 21, 2023 20:29
Signed-off-by: Sharad <sharadgaur@gmail.com>
for _, v := range e.endpoints {
status := v.getStatus()
if status != nil {
if e.storeSelector.RelabelConfigEnabled() {
Copy link
Contributor

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.

// Initial update.
endpointSet.Update(context.Background())
testutil.Equals(t, 3, len(endpointSet.endpoints))
testutil.Equals(t, 3, len(endpointSet.GetStoreClients()))
Copy link
Contributor

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.

@@ -389,7 +395,20 @@ func (e *EndpointSet) Update(ctx context.Context) {
newRef.Close()
return
}
if len(newRef.labelSets()) > 0 {
Copy link
Author

@sharadgaur sharadgaur Feb 22, 2023

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.

Copy link
Contributor

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?

}

func (sr *StoreSelector) MatchStore(labelSets ...labels.Labels) (bool, []labels.Labels) {
if sr.relabelConfig == nil {
Copy link
Author

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>
@stale
Copy link

stale bot commented May 21, 2023

Hello 👋 Looks like there was no activity on this amazing PR for the last 30 days.
Do you mind updating us on the status? Is there anything we can help with? If you plan to still work on it, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity in the next week, this issue will be closed (we can always reopen a PR if you get back to this!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label May 21, 2023
@stale
Copy link

stale bot commented Jun 18, 2023

Closing for now as promised, let us know if you need this to be reopened! 🤗

@stale stale bot closed this Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants