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

Loki datasource: pass through interval variables
This commit is contained in:
Domas 2023-12-20 10:24:06 +02:00 committed by GitHub
parent 0424d44b39
commit b312f48c10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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),
};
}