OpenSearch: Add timeRange to parameters passed to getTagValues (#74952)

This commit is contained in:
Isabella Siu 2023-09-25 09:57:39 -04:00 committed by GitHub
parent da23aef83d
commit 4cc72a22ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ import React from 'react';
import { AdHocVariableFilter, DataSourceRef, MetricFindValue, SelectableValue } from '@grafana/data'; import { AdHocVariableFilter, DataSourceRef, MetricFindValue, SelectableValue } from '@grafana/data';
import { SegmentAsync } from '@grafana/ui'; import { SegmentAsync } from '@grafana/ui';
import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { getDatasourceSrv } from '../../../plugins/datasource_srv'; import { getDatasourceSrv } from '../../../plugins/datasource_srv';
@ -51,8 +52,9 @@ const fetchFilterValues = async (
return []; return [];
} }
const timeRange = getTimeSrv().timeRange();
// Filter out the current filter key from the list of all filters // Filter out the current filter key from the list of all filters
const otherFilters = allFilters.filter((f) => f.key !== key); 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 })); return metrics.map((m: MetricFindValue) => ({ label: m.text, value: m.text }));
}; };