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

Support Prometheus /api/v1/status/buildinfo API on Querier/QFE #4978

Merged
merged 4 commits into from
Nov 23, 2022

Conversation

yeya24
Copy link
Collaborator

@yeya24 yeya24 commented Nov 19, 2022

Signed-off-by: Ben Ye benye@amazon.com

What this PR does:

Grafana uses this API to detect Cortex version and decides whether to use series API with matchers or the label values API. Support it will benefit Grafana & Cortex users to use an API with better performance.

This is a new feature in Grafana grafana/grafana#56496.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@yeya24
Copy link
Collaborator Author

yeya24 commented Nov 19, 2022

An open question:

From the Cortex project's point view, shall we support this API on all Cortex components? Thanos support this API for all.

But from Grafana's perspective, exposing this on the query component should be good enough.

Copy link
Member

@alvinlin123 alvinlin123 left a comment

Choose a reason for hiding this comment

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

possible to write an unit test for this?

Copy link
Member

@alvinlin123 alvinlin123 left a comment

Choose a reason for hiding this comment

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

Possible to write an unit test for this?

Also, should the API path make it clear that it's the underlying Prometheus build info and not the Cortex build info? How about a build info for Thanos? I guess my point is - should the build info API include information about Cortex, Thanos, and Prometheus (also Alertmanager)?

@yeya24
Copy link
Collaborator Author

yeya24 commented Nov 19, 2022

In terms of the additional information in the build info API, I think we could add some cortex specific info to so that we know it is Cortex. But I don't think Prometheus or Thanos would do the same thing right now, at least for Thanos.

The usecase is not very clear and no client really needs it right now, even Grafana it relies on user input to decide whether it is Thanos, Cortex, etc.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Nov 19, 2022
@yeya24 yeya24 force-pushed the support-buildinfo-api branch 3 times, most recently from ca6f19e to e08a33f Compare November 19, 2022 19:08
@yeya24
Copy link
Collaborator Author

yeya24 commented Nov 21, 2022

Tested working using my local Grafana and the version can be automatically detected.

@@ -211,7 +212,11 @@ func NewQuerierHandler(
false,
regexp.MustCompile(".*"),
func() (v1.RuntimeInfo, error) { return v1.RuntimeInfo{}, errors.New("not implemented") },
&v1.PrometheusVersion{},
&v1.PrometheusVersion{
Copy link
Member

Choose a reason for hiding this comment

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

Why we decided not to support the following?

BuildUser string `json:"buildUser"`
BuildDate string `json:"buildDate"`
GoVersion string `json:"goVersion"`

Not that I want to support them, but I thought it do be nice to have explicit discussion on this as documentation purposes.

Copy link
Collaborator Author

@yeya24 yeya24 Nov 21, 2022

Choose a reason for hiding this comment

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

I could add GoVersion for sure. Thanks for catching.
But for other variables, right now we don't propagate these variables right now from our build. I will add them here first and when needed we can propagate these info through makefile

Copy link
Member

@alvinlin123 alvinlin123 left a comment

Choose a reason for hiding this comment

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

Can we create an issue to remember to update https://cortexmetrics.io/docs/api/ for the next issue after this PR is merged?

@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 21, 2022
@yeya24
Copy link
Collaborator Author

yeya24 commented Nov 21, 2022

@alvinlin123 I updated the API doc.

@alvinlin123
Copy link
Member

alvinlin123 commented Nov 22, 2022

I updated the API doc.

Sorry that mislead you with my previous comment. But, problem with updating it now is that people using non-main brach may get confused. I think we should update the API doc while doing 1.15 release. I have created a release 1.15 milestone can you add an issue to update the API doc in that milestone? Thanks

I really hope we can have a version selector in our API doc ...

@yeya24
Copy link
Collaborator Author

yeya24 commented Nov 22, 2022

@alvinlin123 I see that makes sense...

Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
@yeya24 yeya24 force-pushed the support-buildinfo-api branch 2 times, most recently from e83ce77 to 0497704 Compare November 22, 2022 20:01
@pull-request-size pull-request-size bot added size/M and removed size/L labels Nov 22, 2022
Signed-off-by: Ben Ye <benye@amazon.com>
@yeya24
Copy link
Collaborator Author

yeya24 commented Nov 22, 2022

Hey @alvinlin123, I reverted the doc update. Could you please take another look?

@yeya24 yeya24 merged commit 0a1c112 into cortexproject:master Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants