From 4cc72a22ad03132295ab3428ed9877ba2cb42eb2 Mon Sep 17 00:00:00 2001 From: Isabella Siu Date: Mon, 25 Sep 2023 09:57:39 -0400 Subject: [PATCH] OpenSearch: Add timeRange to parameters passed to getTagValues (#74952) --- .../app/features/variables/adhoc/picker/AdHocFilterValue.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/app/features/variables/adhoc/picker/AdHocFilterValue.tsx b/public/app/features/variables/adhoc/picker/AdHocFilterValue.tsx index a1cf784f2cb..ac0b38a6e55 100644 --- a/public/app/features/variables/adhoc/picker/AdHocFilterValue.tsx +++ b/public/app/features/variables/adhoc/picker/AdHocFilterValue.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { AdHocVariableFilter, DataSourceRef, MetricFindValue, SelectableValue } from '@grafana/data'; import { SegmentAsync } from '@grafana/ui'; +import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv'; import { getDatasourceSrv } from '../../../plugins/datasource_srv'; @@ -51,8 +52,9 @@ const fetchFilterValues = async ( return []; } + const timeRange = getTimeSrv().timeRange(); // Filter out the current filter key from the list of all filters const otherFilters = allFilters.filter((f) => f.key !== key); - const metrics = await ds.getTagValues({ key, filters: otherFilters }); + const metrics = await ds.getTagValues({ key, filters: otherFilters, timeRange }); return metrics.map((m: MetricFindValue) => ({ label: m.text, value: m.text })); };