Commit 34e3683d by Torkel Ödegaard

fix(cloudwatch): fixed limiting of cloudwatch period so it works for long time…

fix(cloudwatch): fixed limiting of cloudwatch period so it works for long time ranges in all cases, fixes #3086
parent 13760b1b
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* **Elasticsearch**: Support for dynamic daily indices for annotations, closes [#3061](https://github.com/grafana/grafana/issues/3061) * **Elasticsearch**: Support for dynamic daily indices for annotations, closes [#3061](https://github.com/grafana/grafana/issues/3061)
### Bug Fixes ### 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) * **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) * **influxdb**: fix for relative time ranges `last x months` and `last x years`, fixes [#3067](https://github.com/grafana/grafana/issues/3067)
......
...@@ -36,12 +36,12 @@ function (angular, _) { ...@@ -36,12 +36,12 @@ function (angular, _) {
query.metricName = templateSrv.replace(target.metricName, options.scopedVars); query.metricName = templateSrv.replace(target.metricName, options.scopedVars);
query.dimensions = convertDimensionFormat(target.dimensions, options.scopedVars); query.dimensions = convertDimensionFormat(target.dimensions, options.scopedVars);
query.statistics = target.statistics; query.statistics = target.statistics;
query.period = parseInt(target.period, 10);
var range = end - start; var range = end - start;
// CloudWatch limit datapoints up to 1440 query.period = parseInt(target.period, 10) || 60;
if (range / query.period >= 1440) { if (range / query.period >= 1440) {
query.period = Math.floor(range / 1440 / 60) * 60; query.period = Math.ceil(range / 1440 / 60) * 60;
} }
queries.push(query); queries.push(query);
......
...@@ -80,9 +80,10 @@ ...@@ -80,9 +80,10 @@
</li> </li>
<li class="tight-form-item query-keyword"> <li class="tight-form-item query-keyword">
Period Period
<tip>Interval between points in seconds</tip>
</li> </li>
<li> <li>
<input type="text" class="input-mini tight-form-input" ng-model="target.period" spellcheck='false' placeholder="period" ng-model-onblur ng-change="refreshMetricData()" /> <input type="text" class="input-mini tight-form-input" ng-model="target.period" spellcheck='false' placeholder="auto" ng-model-onblur ng-change="refreshMetricData()" />
</li> </li>
</ul> </ul>
......
...@@ -15,7 +15,7 @@ function (angular, _) { ...@@ -15,7 +15,7 @@ function (angular, _) {
target.metricName = target.metricName || ''; target.metricName = target.metricName || '';
target.statistics = target.statistics || ['Average']; target.statistics = target.statistics || ['Average'];
target.dimensions = target.dimensions || {}; target.dimensions = target.dimensions || {};
target.period = target.period || 60; target.period = target.period || '';
target.region = target.region || $scope.datasource.getDefaultRegion(); target.region = target.region || $scope.datasource.getDefaultRegion();
$scope.aliasSyntax = '{{metric}} {{stat}} {{namespace}} {{region}} {{<dimension name>}}'; $scope.aliasSyntax = '{{metric}} {{stat}} {{namespace}} {{region}} {{<dimension name>}}';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment