Loki: Replace pre-calculated $__interval values for backend interpolation (#79697)

Loki datasource: pass through interval variables
pull/79744/head
Domas 1 year ago committed by GitHub
parent 0424d44b39
commit b312f48c10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      public/app/plugins/datasource/loki/datasource.ts

@ -1085,10 +1085,21 @@ export class LokiDatasource
const exprWithAdHoc = this.addAdHocFilters(target.expr, adhocFilters);
const variables = {
...rest,
// pass through for backend interpolation. Need to be in scopedVars for Scenes though
__interval: {
value: '$__interval',
},
__interval_ms: {
value: '$__interval_ms',
},
};
return {
...target,
legendFormat: this.templateSrv.replace(target.legendFormat, rest),
expr: this.templateSrv.replace(exprWithAdHoc, rest, this.interpolateQueryExpr),
expr: this.templateSrv.replace(exprWithAdHoc, variables, this.interpolateQueryExpr),
};
}

Loading…
Cancel
Save