Datasource/Loki: Fix issue where annotation queries weren't getting their variables interpolated (#20702)

Closes #20667
This commit is contained in:
kay delaney 2019-11-27 14:58:21 +00:00 committed by David
parent 616e2eb29f
commit d6ef02b3b3

View File

@ -581,7 +581,8 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
return [];
}
const query = { refId: `annotation-${options.annotation.name}`, expr: options.annotation.expr };
const interpolatedExpr = this.templateSrv.replace(options.annotation.expr, {}, this.interpolateQueryExpr);
const query = { refId: `annotation-${options.annotation.name}`, expr: interpolatedExpr };
const { data } = await this.runRangeQueryWithFallback(query, options).toPromise();
const annotations: AnnotationEvent[] = [];