fix(cloudwatch): fixed limiting of cloudwatch period so it works for long time ranges in all cases, fixes #3086

This commit is contained in:
Torkel Ödegaard
2015-10-29 16:46:58 +01:00
parent 13760b1bdd
commit 34e3683ded
4 changed files with 7 additions and 5 deletions

View File

@@ -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);

View File

@@ -80,9 +80,10 @@
</li>
<li class="tight-form-item query-keyword">
Period
<tip>Interval between points in seconds</tip>
</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>
</ul>

View File

@@ -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}} {{<dimension name>}}';