From a20c41958321b236de784a26b25eb67787e057cc Mon Sep 17 00:00:00 2001 From: Ryan Patterson Date: Mon, 18 Sep 2017 02:12:52 -0700 Subject: [PATCH] Fully fill out nulls in cloudfront data source (#9268) Summary: Previously, cloudwatch data sources would only fill in a single null value if there was missing data. This results in behavior described in #9267. This resolves that issue by filling the entire missing period with null values. The null values can then be interpreted as normal by the graphing frontend. Test Plan: Used on a data source that had missing data for many consecutive periods. Ensured that the graph remained at 0 across the entire window. --- public/app/plugins/datasource/cloudwatch/datasource.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 3807464e3d57..2ec89b854c65 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -386,8 +386,9 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot }) .each(function(dp) { var timestamp = new Date(dp.Timestamp).getTime(); - if (lastTimestamp && (timestamp - lastTimestamp) > periodMs) { + while (lastTimestamp && (timestamp - lastTimestamp) > periodMs) { dps.push([null, lastTimestamp + periodMs]); + lastTimestamp = lastTimestamp + periodMs; } lastTimestamp = timestamp; if (!extended) {