loki: backend-mode: allow for dashboards too (#47578)

This commit is contained in:
Gábor Farkas 2022-04-12 12:16:05 +02:00 committed by GitHub
parent a5530d36a7
commit 8db35b9b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,6 @@ import Prism from 'prismjs';
import { import {
AnnotationEvent, AnnotationEvent,
AnnotationQueryRequest, AnnotationQueryRequest,
CoreApp,
DataFrame, DataFrame,
DataFrameView, DataFrameView,
DataQueryError, DataQueryError,
@ -153,9 +152,7 @@ export class LokiDatasource
...this.getRangeScopedVars(request.range), ...this.getRangeScopedVars(request.range),
}; };
const shouldRunBackendQuery = config.featureToggles.lokiBackendMode && request.app === CoreApp.Explore; if (config.featureToggles.lokiBackendMode) {
if (shouldRunBackendQuery) {
// we "fix" the loki queries to have `.queryType` and not have `.instant` and `.range` // we "fix" the loki queries to have `.queryType` and not have `.instant` and `.range`
const fixedRequest = { const fixedRequest = {
...request, ...request,
@ -789,7 +786,7 @@ export class LokiDatasource
} }
// Used when running queries through backend // Used when running queries through backend
applyTemplateVariables(target: LokiQuery, scopedVars: ScopedVars): Record<string, any> { applyTemplateVariables(target: LokiQuery, scopedVars: ScopedVars): LokiQuery {
// We want to interpolate these variables on backend // We want to interpolate these variables on backend
const { __interval, __interval_ms, ...rest } = scopedVars; const { __interval, __interval_ms, ...rest } = scopedVars;