mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
Integrate Scopes with Prometheus datasource (#84888)
This commit is contained in:
parent
db791e8955
commit
30a1178624
@ -1,3 +1,4 @@
|
||||
import { Scope } from '@grafana/data';
|
||||
import * as common from '@grafana/schema';
|
||||
|
||||
export enum QueryEditorMode {
|
||||
@ -41,7 +42,5 @@ export interface Prometheus extends common.DataQuery {
|
||||
* Returns a Range vector, comprised of a set of time series containing a range of data points over time for each time series
|
||||
*/
|
||||
range?: boolean;
|
||||
scope?: {
|
||||
matchers: string;
|
||||
};
|
||||
scope?: Scope;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import {
|
||||
import {
|
||||
BackendDataSourceResponse,
|
||||
BackendSrvRequest,
|
||||
config,
|
||||
DataSourceWithBackend,
|
||||
FetchResponse,
|
||||
getBackendSrv,
|
||||
@ -363,6 +364,11 @@ export class PrometheusDatasource
|
||||
// We need to pass utcOffsetSec to backend to calculate aligned range
|
||||
utcOffsetSec: request.range.to.utcOffset() * 60,
|
||||
};
|
||||
|
||||
if (config.featureToggles.promQLScope) {
|
||||
processedTarget.scope = request.scope;
|
||||
}
|
||||
|
||||
if (target.instant && target.range) {
|
||||
// We have query type "Both" selected
|
||||
// We should send separate queries with different refId
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Scope } from '@grafana/data';
|
||||
import * as common from '@grafana/schema';
|
||||
|
||||
export enum QueryEditorMode {
|
||||
@ -41,7 +42,8 @@ export interface Prometheus extends common.DataQuery {
|
||||
* Returns a Range vector, comprised of a set of time series containing a range of data points over time for each time series
|
||||
*/
|
||||
range?: boolean;
|
||||
scope?: {
|
||||
matchers: string;
|
||||
};
|
||||
/**
|
||||
* A scope object that will be used by Prometheus
|
||||
*/
|
||||
scope?: Scope;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import {
|
||||
import {
|
||||
BackendDataSourceResponse,
|
||||
BackendSrvRequest,
|
||||
config,
|
||||
DataSourceWithBackend,
|
||||
FetchResponse,
|
||||
getBackendSrv,
|
||||
@ -363,6 +364,11 @@ export class PrometheusDatasource
|
||||
// We need to pass utcOffsetSec to backend to calculate aligned range
|
||||
utcOffsetSec: request.range.to.utcOffset() * 60,
|
||||
};
|
||||
|
||||
if (config.featureToggles.promQLScope) {
|
||||
processedTarget.scope = request.scope;
|
||||
}
|
||||
|
||||
if (target.instant && target.range) {
|
||||
// We have query type "Both" selected
|
||||
// We should send separate queries with different refId
|
||||
|
Loading…
Reference in New Issue
Block a user