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

[Sidecar] Querying external label values with a matcher produces wrong results #6338

Closed
dmitrime opened this issue May 5, 2023 · 2 comments

Comments

@dmitrime
Copy link

dmitrime commented May 5, 2023

Thanos, Prometheus and Golang version used:
Thanos: v0.30.2
Prometheus: 2.42.0
Go: 1.20.3

Object Storage Provider:
Minio/S3

What happened:
Querying GET /api/v1/label/<label_name>/values API produces wrong results when the <label_name> is an external label and a match[] parameter is provided.

I've narrowed it down to sidecar, the store results seem to be okay. For example, given 2 sidecars having an external label region with values europe and asia and some_metric present, I then query:

GET /api/v1/label/region/values?start=1683092000&end=1683092999&match[]=some_metric{region="asia"}

I receive the response:

{"status":"success","data":["europe","asia"]}

What you expected to happen:

{"status":"success","data":["asia"]}

How to reproduce it (as minimally and precisely as possible):

Add the following test to https://github.com/thanos-io/thanos/blob/main/pkg/store/acceptance_test.go#L60:

                               {
                                       start:    timestamp.FromTime(minTime),
                                       end:      timestamp.FromTime(maxTime),
                                       label:    "region",
                                       matchers: []storepb.LabelMatcher{{Type: storepb.LabelMatcher_EQ, Name: "unknown", Value: "unknown"}},
                               },

This will fail by returning eu-west when in fact the matcher doesn't match any labels.

The problematic code seems to be this: https://github.com/thanos-io/thanos/blob/main/pkg/store/prometheus.go#L696-L699
If the external label is the one requested, then its value is returned without any further matching.

@dmitrime
Copy link
Author

dmitrime commented May 8, 2023

Related to #3639 which got closed without resolution.

@GiedriusS
Copy link
Member

Fixed in #6816.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants