Commit 5fa5d4bd by Joshua Piccari Committed by Torkel Ödegaard

CloudWatch: Avoid exception while accessing results (#17283)

When accessing the `series` property of query results, if a query is
hidden, an exception is thrown. This is caused by lack of checks to
verify that the query result exists before accessing the `series`
property.

Closes #17112
parent a1a498f9
......@@ -149,6 +149,7 @@ export default class CloudWatchDatasource extends DataSourceApi<CloudWatchQuery>
if (res.results) {
for (const query of request.queries) {
const queryRes = res.results[query.refId];
if (queryRes) {
for (const series of queryRes.series) {
const s = { target: series.name, datapoints: series.points } as any;
if (queryRes.meta.unit) {
......@@ -158,6 +159,7 @@ export default class CloudWatchDatasource extends DataSourceApi<CloudWatchQuery>
}
}
}
}
return { data: data };
});
......
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