From b625d60aa92db7f0c7c20a756bbad82974e9f3c6 Mon Sep 17 00:00:00 2001 From: Brendan O'Handley Date: Mon, 29 Jan 2024 07:56:45 -0600 Subject: [PATCH] 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 --------- Co-authored-by: ismail simsek --- .../components/PrometheusMetricsBrowser.test.tsx | 8 +++++++- .../prometheus/components/PrometheusMetricsBrowser.tsx | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.test.tsx b/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.test.tsx index 7ac62d9bd32..b5cc16744a8 100644 --- a/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.test.tsx +++ b/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.test.tsx @@ -114,7 +114,13 @@ describe('PrometheusMetricsBrowser', () => { } 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) { case '{label1="value1-1"}': return { label1: ['value1-1'], label2: ['value2-1'], label3: ['value3-1'] }; diff --git a/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.tsx b/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.tsx index 33f5570e64a..b877843cddb 100644 --- a/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.tsx +++ b/public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.tsx @@ -415,7 +415,7 @@ export class UnthemedPrometheusMetricsBrowser extends React.Component