mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(cloudwatch): fixed limiting of cloudwatch period so it works for long time ranges in all cases, fixes #3086
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>}}';
|
||||
|
||||
Reference in New Issue
Block a user