mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prometheus: Only use the series endpoint in the metrics browser (#81419)
* only use the series endpoint in the metrics browser * Update public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.test.tsx Co-authored-by: ismail simsek <ismailsimsek09@gmail.com> --------- Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
This commit is contained in:
parent
329440cb1e
commit
b625d60aa9
@ -114,7 +114,13 @@ describe('PrometheusMetricsBrowser', () => {
|
|||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
fetchLabelsWithMatch: (selector: string) => {
|
// This must always call the series endpoint
|
||||||
|
// until we refactor all of the metrics browser
|
||||||
|
// to never use the series endpoint.
|
||||||
|
// The metrics browser expects both label names and label values.
|
||||||
|
// The labels endpoint with match does not supply label values
|
||||||
|
// and so using it breaks the metrics browser.
|
||||||
|
fetchSeriesLabels: (selector: string) => {
|
||||||
switch (selector) {
|
switch (selector) {
|
||||||
case '{label1="value1-1"}':
|
case '{label1="value1-1"}':
|
||||||
return { label1: ['value1-1'], label2: ['value2-1'], label3: ['value3-1'] };
|
return { label1: ['value1-1'], label2: ['value2-1'], label3: ['value3-1'] };
|
||||||
|
@ -415,7 +415,7 @@ export class UnthemedPrometheusMetricsBrowser extends React.Component<BrowserPro
|
|||||||
this.updateLabelState(lastFacetted, { loading: true }, `Facetting labels for ${selector}`);
|
this.updateLabelState(lastFacetted, { loading: true }, `Facetting labels for ${selector}`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const possibleLabels = await languageProvider.fetchLabelsWithMatch(selector, true);
|
const possibleLabels = await languageProvider.fetchSeriesLabels(selector, true);
|
||||||
// If selector changed, clear loading state and discard result by returning early
|
// If selector changed, clear loading state and discard result by returning early
|
||||||
if (selector !== buildSelector(this.state.labels)) {
|
if (selector !== buildSelector(this.state.labels)) {
|
||||||
if (lastFacetted) {
|
if (lastFacetted) {
|
||||||
|
Loading…
Reference in New Issue
Block a user