diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e67f9b0052..85b9a1121c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * **Elasticsearch**: Support for dynamic daily indices for annotations, closes [#3061](https://github.com/grafana/grafana/issues/3061) ### Bug Fixes +* **cloudwatch**: fix for handling of period for long time ranges, fixes [#3086](https://github.com/grafana/grafana/issues/3086) * **dashboard**: fix for collapse row by clicking on row title, fixes [#3065](https://github.com/grafana/grafana/issues/3065) * **influxdb**: fix for relative time ranges `last x months` and `last x years`, fixes [#3067](https://github.com/grafana/grafana/issues/3067) diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 6a99724123b..576fb9ffcdd 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -36,12 +36,12 @@ function (angular, _) { query.metricName = templateSrv.replace(target.metricName, options.scopedVars); query.dimensions = convertDimensionFormat(target.dimensions, options.scopedVars); query.statistics = target.statistics; - query.period = parseInt(target.period, 10); var range = end - start; - // CloudWatch limit datapoints up to 1440 + query.period = parseInt(target.period, 10) || 60; + if (range / query.period >= 1440) { - query.period = Math.floor(range / 1440 / 60) * 60; + query.period = Math.ceil(range / 1440 / 60) * 60; } queries.push(query); diff --git a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html index 80491a284f6..d05ffd8547f 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html +++ b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html @@ -80,9 +80,10 @@
  • Period + Interval between points in seconds
  • - +
  • diff --git a/public/app/plugins/datasource/cloudwatch/query_ctrl.js b/public/app/plugins/datasource/cloudwatch/query_ctrl.js index ccbc36f0912..3869a5ec715 100644 --- a/public/app/plugins/datasource/cloudwatch/query_ctrl.js +++ b/public/app/plugins/datasource/cloudwatch/query_ctrl.js @@ -15,7 +15,7 @@ function (angular, _) { target.metricName = target.metricName || ''; target.statistics = target.statistics || ['Average']; target.dimensions = target.dimensions || {}; - target.period = target.period || 60; + target.period = target.period || ''; target.region = target.region || $scope.datasource.getDefaultRegion(); $scope.aliasSyntax = '{{metric}} {{stat}} {{namespace}} {{region}} {{}}';