From bbfdbaf95212edecb18738ba660279b121d52ff9 Mon Sep 17 00:00:00 2001 From: Ivan Babrou Date: Thu, 21 Jan 2016 16:38:39 +0000 Subject: [PATCH] Support OpenTSDB 2.2 fill policies, closes #3802 --- .../plugins/datasource/opentsdb/datasource.js | 4 ++++ .../opentsdb/partials/query.editor.html | 16 ++++++++++++++-- .../app/plugins/datasource/opentsdb/queryCtrl.js | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/opentsdb/datasource.js b/public/app/plugins/datasource/opentsdb/datasource.js index b9593c013a1..d7cc354861f 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.js +++ b/public/app/plugins/datasource/opentsdb/datasource.js @@ -272,6 +272,10 @@ function (angular, _, dateMath) { } query.downsample = interval + "-" + target.downsampleAggregator; + + if (target.downsampleFillPolicy !== "none") { + query.downsample += "-" + target.downsampleFillPolicy; + } } query.tags = angular.copy(target.tags); diff --git a/public/app/plugins/datasource/opentsdb/partials/query.editor.html b/public/app/plugins/datasource/opentsdb/partials/query.editor.html index 8a3c0c0f753..fffa7194228 100644 --- a/public/app/plugins/datasource/opentsdb/partials/query.editor.html +++ b/public/app/plugins/datasource/opentsdb/partials/query.editor.html @@ -104,8 +104,20 @@ -
  • - Disable downsampling +
  • + Fill policy + Available since OpenTSDB 2.2 +
  • + +
  • + +
  • + +
  • + Disable downsampling
  • diff --git a/public/app/plugins/datasource/opentsdb/queryCtrl.js b/public/app/plugins/datasource/opentsdb/queryCtrl.js index 8af3af206b6..14d28c310c2 100644 --- a/public/app/plugins/datasource/opentsdb/queryCtrl.js +++ b/public/app/plugins/datasource/opentsdb/queryCtrl.js @@ -13,6 +13,7 @@ function (angular, _, kbn) { $scope.init = function() { $scope.target.errors = validateTarget($scope.target); $scope.aggregators = ['avg', 'sum', 'min', 'max', 'dev', 'zimsum', 'mimmin', 'mimmax']; + $scope.fillPolicies = ['none', 'nan', 'null', 'zero']; if (!$scope.target.aggregator) { $scope.target.aggregator = 'sum'; @@ -22,6 +23,10 @@ function (angular, _, kbn) { $scope.target.downsampleAggregator = 'avg'; } + if (!$scope.target.downsampleFillPolicy) { + $scope.target.downsampleFillPolicy = 'none'; + } + $scope.datasource.getAggregators().then(function(aggs) { $scope.aggregators = aggs; });