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

*: update Cortex (and Prometheus) dependency #4586

Merged
merged 8 commits into from
Sep 1, 2021

Conversation

GiedriusS
Copy link
Member

@GiedriusS GiedriusS commented Aug 20, 2021

Update Cortex dependency (and Prometheus together) to include
cortexproject/cortex@70dddb6.

storage.Querier finally has support for label.Matchers so now we can
fully pass them down. This is covered by tests. Plus, I've played around a bit
with these changes locally.

Signed-off-by: Giedrius Statkevičius [email protected]

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

Update Cortex dependency (and Prometheus together) to include
cortexproject/cortex@70dddb6.

storage.Querier finally has support for label.Matchers so now we can
fully pass them down.

Signed-off-by: Giedrius Statkevičius <[email protected]>
@yeya24
Copy link
Contributor

yeya24 commented Aug 21, 2021

Nice! Is this pr ready for review now?

@GiedriusS
Copy link
Member Author

Nice! Is this pr ready for review now?

No, still need to fix the tests hence it is a draft

}
sort.Strings(res)
}

Copy link
Member Author

@GiedriusS GiedriusS Aug 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the biggest change - in this function 😄 We have to add external labels here now so that the behaviour would be the same as previously. We were doing Select() and then picking label names out of all series so naturally, they would have external labels there.

@GiedriusS GiedriusS marked this pull request as ready for review August 30, 2021 15:58
@GiedriusS
Copy link
Member Author

@yeya24 fixed the tests, PTAL 🍻

cmd/thanos/receive.go Show resolved Hide resolved
pkg/query/querier.go Show resolved Hide resolved
@@ -657,13 +657,13 @@ func (qapi *QueryAPI) labelNames(r *http.Request) (interface{}, []error, *api.Ap
return nil, nil, apiErr
}

var matcherSets [][]*labels.Matcher
var matcherSets []*labels.Matcher
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior changes here. We need to support multiple matchers, same as the label values API.

Signed-off-by: Giedrius Statkevičius <[email protected]>
@GiedriusS
Copy link
Member Author

@yeya24 thanks for the very quick review! ❤️

Signed-off-by: Giedrius Statkevičius <[email protected]>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thanks! 💪🏽

@bwplotka bwplotka merged commit bdf7e21 into thanos-io:main Sep 1, 2021
@@ -702,7 +702,7 @@ func (c *Client) SeriesInGRPC(ctx context.Context, base *url.URL, matchers []*la
return m.Data, c.get2xxResultWithGRPCErrors(ctx, "/prom_series HTTP[client]", &u, &m)
}

// LabelNames returns all known label names. It uses gRPC errors.
// LabelNames returns all known label names constrained by the given matchers. It uses gRPC errors.
// NOTE: This method is tested in pkg/store/prometheus_test.go against Prometheus.
func (c *Client) LabelNamesInGRPC(ctx context.Context, base *url.URL, matchers []storepb.LabelMatcher, startTime, endTime int64) ([]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still not sufficient I think. If the Prometheus server doesn't support label name matchers, then all label names will be returned. What about doing the same as https://github.com/thanos-io/thanos/blob/main/pkg/store/prometheus.go#L533-L567? Checking Prometheus version seems safer here.
@GiedriusS @bwplotka

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, some compatibility code has to be there, thanks for being careful. I am on PTO until Monday, will catch on this unless someone else does 🤗

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL #4628.

someshkoli pushed a commit to someshkoli/thanos that referenced this pull request Nov 7, 2021
* *: update Cortex (and Prometheus) dependency

Update Cortex dependency (and Prometheus together) to include
cortexproject/cortex@70dddb6.

storage.Querier finally has support for label.Matchers so now we can
fully pass them down.

Signed-off-by: Giedrius Statkevičius <[email protected]>

* *: fix tests by passing EnableExemplarStorage

Signed-off-by: Giedrius Statkevičius <[email protected]>

* CHANGELOG: update with note about LabelNames() pushdown

Signed-off-by: Giedrius Statkevičius <[email protected]>

* store: pass along matchers in proxy

Signed-off-by: Giedrius Statkevičius <[email protected]>

* store: fix e2e labelname tests

Signed-off-by: Giedrius Statkevičius <[email protected]>

* Fix according to Ben's comments

Signed-off-by: Giedrius Statkevičius <[email protected]>

* test/e2e: fix grammar issue in a comment

Signed-off-by: Giedrius Statkevičius <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants