mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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';
|
import * as common from '@grafana/schema';
|
||||||
|
|
||||||
export enum QueryEditorMode {
|
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
|
* 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;
|
range?: boolean;
|
||||||
scope?: {
|
scope?: Scope;
|
||||||
matchers: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
BackendDataSourceResponse,
|
BackendDataSourceResponse,
|
||||||
BackendSrvRequest,
|
BackendSrvRequest,
|
||||||
|
config,
|
||||||
DataSourceWithBackend,
|
DataSourceWithBackend,
|
||||||
FetchResponse,
|
FetchResponse,
|
||||||
getBackendSrv,
|
getBackendSrv,
|
||||||
@ -363,6 +364,11 @@ export class PrometheusDatasource
|
|||||||
// We need to pass utcOffsetSec to backend to calculate aligned range
|
// We need to pass utcOffsetSec to backend to calculate aligned range
|
||||||
utcOffsetSec: request.range.to.utcOffset() * 60,
|
utcOffsetSec: request.range.to.utcOffset() * 60,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (config.featureToggles.promQLScope) {
|
||||||
|
processedTarget.scope = request.scope;
|
||||||
|
}
|
||||||
|
|
||||||
if (target.instant && target.range) {
|
if (target.instant && target.range) {
|
||||||
// We have query type "Both" selected
|
// We have query type "Both" selected
|
||||||
// We should send separate queries with different refId
|
// We should send separate queries with different refId
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { Scope } from '@grafana/data';
|
||||||
import * as common from '@grafana/schema';
|
import * as common from '@grafana/schema';
|
||||||
|
|
||||||
export enum QueryEditorMode {
|
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
|
* 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;
|
range?: boolean;
|
||||||
scope?: {
|
/**
|
||||||
matchers: string;
|
* A scope object that will be used by Prometheus
|
||||||
};
|
*/
|
||||||
|
scope?: Scope;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
BackendDataSourceResponse,
|
BackendDataSourceResponse,
|
||||||
BackendSrvRequest,
|
BackendSrvRequest,
|
||||||
|
config,
|
||||||
DataSourceWithBackend,
|
DataSourceWithBackend,
|
||||||
FetchResponse,
|
FetchResponse,
|
||||||
getBackendSrv,
|
getBackendSrv,
|
||||||
@ -363,6 +364,11 @@ export class PrometheusDatasource
|
|||||||
// We need to pass utcOffsetSec to backend to calculate aligned range
|
// We need to pass utcOffsetSec to backend to calculate aligned range
|
||||||
utcOffsetSec: request.range.to.utcOffset() * 60,
|
utcOffsetSec: request.range.to.utcOffset() * 60,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (config.featureToggles.promQLScope) {
|
||||||
|
processedTarget.scope = request.scope;
|
||||||
|
}
|
||||||
|
|
||||||
if (target.instant && target.range) {
|
if (target.instant && target.range) {
|
||||||
// We have query type "Both" selected
|
// We have query type "Both" selected
|
||||||
// We should send separate queries with different refId
|
// We should send separate queries with different refId
|
||||||
|
Loading…
Reference in New Issue
Block a user