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.
This commit is contained in:
Andrew McDonald
2016-11-11 08:54:44 +01:00
committed by Torkel Ödegaard
parent e04d27c0b0
commit b98f817d68
@@ -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;
}