Added initial metric functions processing.
This commit is contained in:
@@ -10,6 +10,7 @@ function (angular, _, moment, utils) {
|
||||
var module = angular.module('grafana.services');
|
||||
|
||||
module.service('DataProcessingService', function() {
|
||||
var self = this;
|
||||
|
||||
/**
|
||||
* Downsample datapoints series
|
||||
@@ -105,5 +106,20 @@ function (angular, _, moment, utils) {
|
||||
return _.max(values);
|
||||
};
|
||||
|
||||
this.aggregationFunctions = {
|
||||
avg: this.AVERAGE,
|
||||
min: this.MIN,
|
||||
max: this.MAX,
|
||||
};
|
||||
|
||||
this.groupByWrapper = function(interval, groupFunc, datapoints) {
|
||||
var groupByCallback = self.aggregationFunctions[groupFunc];
|
||||
return self.groupBy(interval, groupByCallback, datapoints);
|
||||
};
|
||||
|
||||
this.metricFunctions = {
|
||||
groupBy: this.groupByWrapper,
|
||||
};
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user