Prometheus: Default support labels value endpoint with match param when prom type and version not set #84778
+17
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #81059
What is this?
When a user creates a new Prometheus data source in Grafana and does not set the type and version, we will support the labels values endpoint with match parameter (labelsMatch) over the series endpoint.
/api/v1/label/__name__/values?match[]=<series_selector>
Special note: The metrics browser still relies on the series endpoint and that will be be refactored in future work.
Why are we defaulting to labels match over series?
For many reasons listed here:
First, when we made the type and version detection feature in the config section, many people did not have the most current versions of Prometheus and so were still needing to have the series endpoint be default. It is now a year and a half later and most people have update Prometheus versions that support the labels match endpoint.
Second, we are moving to refactor all series endpoint calls out of the Prometheus data source plugin and this is a part of that work.
Third, the series endpoint is expensive to call and we think that people should have to opt into that.
Special notes for your reviewer:
/api/v1/label/__name__/values?match[]=<series_selector>
has been called.Also, to see the series endpoint called, set the type and version in the config section to Prometheus type < 2.24 or follow the following guidelines for not supporting the label endpoint with match[] param
grafana/public/app/plugins/datasource/prometheus/datasource.ts
Lines 176 to 188 in f3986f0
Please check that: