From b98f817d682a957da112df38a012c0bf5f7f9903 Mon Sep 17 00:00:00 2001 From: Andrew McDonald Date: Thu, 10 Nov 2016 23:54:44 -0800 Subject: [PATCH] Fix for cloudwatch datasource requesting too many datapoints (#6544) The range checking in _getPeriod appeared to be using a different variable than the period that had just been calculated for its bounds checks. --- public/app/plugins/datasource/cloudwatch/datasource.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index fde9e8f09ea..105b08c2b17 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -78,10 +78,10 @@ function (angular, _, moment, dateMath, kbn, CloudWatchAnnotationQuery) { } else { period = kbn.interval_to_seconds(templateSrv.replace(target.period, options.scopedVars)); } - if (query.period < 60) { + if (period < 60) { period = 60; } - if (range / query.period >= 1440) { + if (range / period >= 1440) { period = Math.ceil(range / 1440 / 60) * 60; }