From 02c0f5929ca6c7fe22c3420ee0314688546c3f77 Mon Sep 17 00:00:00 2001 From: Darren Janeczek <38694490+darrenjaneczek@users.noreply.github.com> Date: Sat, 10 Feb 2024 09:57:11 -0500 Subject: [PATCH] prometheus: fix: use shallow clone of scopedVars (#82280) fix: use shallow clone of scopedVars --- packages/grafana-prometheus/src/datasource.ts | 4 ++-- public/app/plugins/datasource/prometheus/datasource.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/grafana-prometheus/src/datasource.ts b/packages/grafana-prometheus/src/datasource.ts index 5b3e9ec7f27..5a0264a4571 100644 --- a/packages/grafana-prometheus/src/datasource.ts +++ b/packages/grafana-prometheus/src/datasource.ts @@ -1,4 +1,4 @@ -import { cloneDeep, defaults } from 'lodash'; +import { defaults } from 'lodash'; import { lastValueFrom, Observable, throwError } from 'rxjs'; import { map, tap } from 'rxjs/operators'; import semver from 'semver/preload'; @@ -877,7 +877,7 @@ export class PrometheusDatasource // Used when running queries through backend applyTemplateVariables(target: PromQuery, scopedVars: ScopedVars, filters?: AdHocVariableFilter[]) { - const variables = cloneDeep(scopedVars); + const variables = { ...scopedVars }; // We want to interpolate these variables on backend. // The pre-calculated values are replaced withe the variable strings. diff --git a/public/app/plugins/datasource/prometheus/datasource.ts b/public/app/plugins/datasource/prometheus/datasource.ts index 5b3e9ec7f27..5a0264a4571 100644 --- a/public/app/plugins/datasource/prometheus/datasource.ts +++ b/public/app/plugins/datasource/prometheus/datasource.ts @@ -1,4 +1,4 @@ -import { cloneDeep, defaults } from 'lodash'; +import { defaults } from 'lodash'; import { lastValueFrom, Observable, throwError } from 'rxjs'; import { map, tap } from 'rxjs/operators'; import semver from 'semver/preload'; @@ -877,7 +877,7 @@ export class PrometheusDatasource // Used when running queries through backend applyTemplateVariables(target: PromQuery, scopedVars: ScopedVars, filters?: AdHocVariableFilter[]) { - const variables = cloneDeep(scopedVars); + const variables = { ...scopedVars }; // We want to interpolate these variables on backend. // The pre-calculated values are replaced withe the variable strings.