diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index f606b6e3dc8..3d335c90d81 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -330,6 +330,9 @@ function (angular, _, moment, dateMath) { dps.push([null, lastTimestamp + periodMs]); } lastTimestamp = timestamp; + if (options.divideSumByPeriod && stat === 'Sum') { + dp[stat] = dp[stat] / options.period; + } dps.push([dp[stat], timestamp]); }); diff --git a/public/app/plugins/datasource/cloudwatch/partials/query.parameter.html b/public/app/plugins/datasource/cloudwatch/partials/query.parameter.html index 7b0785e808d..bd5dc9fb6ae 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/query.parameter.html +++ b/public/app/plugins/datasource/cloudwatch/partials/query.parameter.html @@ -52,6 +52,9 @@
  • +
  • + Sum / Period +
  • diff --git a/public/app/plugins/datasource/cloudwatch/query_ctrl.js b/public/app/plugins/datasource/cloudwatch/query_ctrl.js index e24b73cd068..deac54a9b24 100644 --- a/public/app/plugins/datasource/cloudwatch/query_ctrl.js +++ b/public/app/plugins/datasource/cloudwatch/query_ctrl.js @@ -10,6 +10,7 @@ function (angular, _) { module.controller('CloudWatchQueryCtrl', function($scope) { $scope.init = function() { + $scope.target.divideSumByPeriod = $scope.target.divideSumByPeriod || false; $scope.aliasSyntax = '{{metric}} {{stat}} {{namespace}} {{region}} {{}}'; };