mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prometheus: Send time range params when requesting labels (#59648)
* Send time range params when requesting labels * Update public/app/plugins/datasource/prometheus/datasource.tsx Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> * Send params when calling values too Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
This commit is contained in:
parent
ece8609e7c
commit
ba2e226ba9
@ -6,8 +6,11 @@ import { catchError, filter, map, tap } from 'rxjs/operators';
|
||||
import semver from 'semver/preload';
|
||||
|
||||
import {
|
||||
AbstractQuery,
|
||||
AnnotationEvent,
|
||||
AnnotationQueryRequest,
|
||||
CoreApp,
|
||||
DataFrame,
|
||||
DataQueryError,
|
||||
DataQueryRequest,
|
||||
DataQueryResponse,
|
||||
@ -16,32 +19,29 @@ import {
|
||||
DataSourceWithQueryImportSupport,
|
||||
dateMath,
|
||||
DateTime,
|
||||
AbstractQuery,
|
||||
dateTime,
|
||||
LoadingState,
|
||||
QueryFixAction,
|
||||
rangeUtil,
|
||||
ScopedVars,
|
||||
TimeRange,
|
||||
DataFrame,
|
||||
dateTime,
|
||||
AnnotationQueryRequest,
|
||||
QueryFixAction,
|
||||
} from '@grafana/data';
|
||||
import {
|
||||
BackendDataSourceResponse,
|
||||
BackendSrvRequest,
|
||||
DataSourceWithBackend,
|
||||
FetchError,
|
||||
FetchResponse,
|
||||
getBackendSrv,
|
||||
DataSourceWithBackend,
|
||||
BackendDataSourceResponse,
|
||||
toDataQueryResponse,
|
||||
isFetchError,
|
||||
toDataQueryResponse,
|
||||
} from '@grafana/runtime';
|
||||
import { Badge, BadgeColor, Tooltip } from '@grafana/ui';
|
||||
import { safeStringifyValue } from 'app/core/utils/explore';
|
||||
import { discoverDataSourceFeatures } from 'app/features/alerting/unified/api/buildInfo';
|
||||
import { getTimeSrv, TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||
import { getTemplateSrv, TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { PromApplication, PromApiFeatures } from 'app/types/unified-alerting-dto';
|
||||
import { PromApiFeatures, PromApplication } from 'app/types/unified-alerting-dto';
|
||||
|
||||
import { addLabelToQuery } from './add_label_to_query';
|
||||
import { AnnotationQueryEditor } from './components/AnnotationQueryEditor';
|
||||
@ -895,13 +895,15 @@ export class PrometheusDatasource
|
||||
return uniqueLabels.map((value: any) => ({ text: value }));
|
||||
} else {
|
||||
// Get all tags
|
||||
const result = await this.metadataRequest('/api/v1/labels');
|
||||
const params = this.getTimeRangeParams();
|
||||
const result = await this.metadataRequest('/api/v1/labels', params);
|
||||
return result?.data?.data?.map((value: any) => ({ text: value })) ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
async getTagValues(options: { key?: string } = {}) {
|
||||
const result = await this.metadataRequest(`/api/v1/label/${options.key}/values`);
|
||||
const params = this.getTimeRangeParams();
|
||||
const result = await this.metadataRequest(`/api/v1/label/${options.key}/values`, params);
|
||||
return result?.data?.data?.map((value: any) => ({ text: value })) ?? [];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user