allow unit override if cloudwatch response unit is none

This commit is contained in:
Mitsuhiro Tanda 2018-10-18 20:51:36 +09:00
parent e465b2d53a
commit 4687ce2f7b

View File

@ -137,7 +137,11 @@ export default class CloudWatchDatasource {
if (res.results) {
_.forEach(res.results, queryRes => {
_.forEach(queryRes.series, series => {
data.push({ target: series.name, datapoints: series.points, unit: queryRes.meta.unit || 'none' });
const s = { target: series.name, datapoints: series.points } as any;
if (queryRes.meta.unit) {
s.unit = queryRes.meta.unit;
}
data.push(s);
});
});
}