Instead of hard-coding the OpenTsdb aggregators list, pull the supported
aggregators from the datasource directly.
This commit is contained in:
@@ -90,6 +90,20 @@ function (angular, _, kbn) {
|
||||
});
|
||||
};
|
||||
|
||||
OpenTSDBDatasource.prototype.performAggregatorsQuery = function() {
|
||||
var options = {
|
||||
method: 'GET',
|
||||
url: this.url + '/api/aggregators'
|
||||
};
|
||||
return $http(options).then(function(result) {
|
||||
if (result.data instanceof Array) {
|
||||
return result.data.sort();
|
||||
} else {
|
||||
return result.data;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function transformMetricData(md, groupByTags, options) {
|
||||
var metricLabel = createMetricLabel(md, options, groupByTags);
|
||||
var dps = [];
|
||||
|
||||
@@ -14,6 +14,12 @@ function (angular, _, kbn) {
|
||||
$scope.target.errors = validateTarget($scope.target);
|
||||
$scope.aggregators = ['avg', 'sum', 'min', 'max', 'dev', 'zimsum', 'mimmin', 'mimmax'];
|
||||
|
||||
$scope.datasource.performAggregatorsQuery().then(function(result) {
|
||||
if (result) {
|
||||
$scope.aggregators = result;
|
||||
}
|
||||
});
|
||||
|
||||
if (!$scope.target.aggregator) {
|
||||
$scope.target.aggregator = 'sum';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user