Commit a8f57b2f by kay delaney Committed by GitHub

Datasource/CloudWatchLogs: Correctly interpolate variables for data links (#26929)

Closes #26792
parent 751a07e3
......@@ -301,14 +301,18 @@ export class CloudWatchDatasource extends DataSourceApi<CloudWatchQuery, CloudWa
const end = range.to.toISOString();
const curTarget = options.targets.find(target => target.refId === dataFrame.refId) as CloudWatchLogsQuery;
const interpolatedGroups =
curTarget.logGroupNames?.map((logGroup: string) =>
this.replace(logGroup, options.scopedVars, true, 'log groups')
) ?? [];
const urlProps: AwsUrl = {
end,
start,
timeType: 'ABSOLUTE',
tz: 'UTC',
editorString: curTarget.expression ?? '',
editorString: curTarget.expression ? this.replace(curTarget.expression, options.scopedVars, true) : '',
isLiveTail: false,
source: curTarget.logGroupNames ?? [],
source: interpolatedGroups,
};
const encodedUrl = encodeUrl(
......@@ -830,9 +834,9 @@ export class CloudWatchDatasource extends DataSourceApi<CloudWatchQuery, CloudWa
this.templateSrv.variableExists(target.region) ||
this.templateSrv.variableExists(target.namespace) ||
this.templateSrv.variableExists(target.metricName) ||
_.find(target.dimensions, (v, k) => {
return this.templateSrv.variableExists(k) || this.templateSrv.variableExists(v);
})
this.templateSrv.variableExists(target.expression!) ||
target.logGroupNames?.some((logGroup: string) => this.templateSrv.variableExists(logGroup)) ||
_.find(target.dimensions, (v, k) => this.templateSrv.variableExists(k) || this.templateSrv.variableExists(v))
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment