From: Nizamudeen A Date: Mon, 22 Sep 2025 15:43:52 +0000 (+0530) Subject: mgr/dashboard: fix prometheus API error when not configured X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0c0e0d436e63fa767da149402fead6a25e513978;p=ceph.git mgr/dashboard: fix prometheus API error when not configured Fixes: https://tracker.ceph.com/issues/73174 Signed-off-by: Nizamudeen A --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts index bf340df1d03..9e41497446b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts @@ -154,10 +154,16 @@ export class PrometheusService { } getGaugeQueryData(query: string): Observable { - return this.getPrometheusQueryData({ params: query }).pipe( - map((result: PromqlGuageMetric) => result), - catchError(() => of({ result: [] } as PromqlGuageMetric)) - ); + let result$: Observable = of({ result: [] } as PromqlGuageMetric); + + this.ifPrometheusConfigured(() => { + result$ = this.getPrometheusQueryData({ params: query }).pipe( + map((result: PromqlGuageMetric) => result), + catchError(() => of({ result: [] } as PromqlGuageMetric)) + ); + }); + + return result$; } formatGuageMetric(data: string): number {