InfluxDB: Flux: make $__interval and $__interval_ms work in alerting (#38889)

* influxdb: flux: handle $__interval and $__interval_ms in alert-queries

* influxdb: flux: do not handle interval-variable in the frontend

* $__interval should be rounded

* added comment
This commit is contained in:
Gábor Farkas
2021-09-27 12:03:04 +02:00
committed by GitHub
parent 24475cfdda
commit 9f027e32b7
4 changed files with 35 additions and 18 deletions

View File

@@ -188,9 +188,12 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery,
throw new Error('applyTemplateVariables called in influxql-mode. this should never happen');
}
// We want to interpolate these variables on backend
const { __interval, __interval_ms, ...rest } = scopedVars;
return {
...query,
query: this.templateSrv.replace(query.query ?? '', scopedVars), // The raw query text
query: this.templateSrv.replace(query.query ?? '', rest), // The raw query text
};
}