|
|
@@ -69,6 +69,11 @@ function (_) {
|
|
|
category: categories.Combine,
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: 'rangeOfSeries',
|
|
|
+ category: categories.Combine
|
|
|
+ });
|
|
|
+
|
|
|
addFuncDef({
|
|
|
name: 'percentileOfSeries',
|
|
|
category: categories.Combine,
|
|
|
@@ -83,6 +88,18 @@ function (_) {
|
|
|
defaultParams: [3]
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: 'maxSeries',
|
|
|
+ shortName: 'max',
|
|
|
+ category: categories.Combine,
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'minSeries',
|
|
|
+ shortName: 'min',
|
|
|
+ category: categories.Combine,
|
|
|
+ });
|
|
|
+
|
|
|
addFuncDef({
|
|
|
name: 'averageSeriesWithWildcards',
|
|
|
category: categories.Combine,
|
|
|
@@ -111,6 +128,19 @@ function (_) {
|
|
|
defaultParams: ['stacked']
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: "consolidateBy",
|
|
|
+ category: categories.Special,
|
|
|
+ params: [
|
|
|
+ {
|
|
|
+ name: 'function',
|
|
|
+ type: 'string',
|
|
|
+ options: ['sum', 'average', 'min', 'max']
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ defaultParams: ['max']
|
|
|
+ });
|
|
|
+
|
|
|
addFuncDef({
|
|
|
name: "groupByNode",
|
|
|
category: categories.Special,
|
|
|
@@ -132,15 +162,43 @@ function (_) {
|
|
|
addFuncDef({
|
|
|
name: 'aliasByNode',
|
|
|
category: categories.Special,
|
|
|
- params: [ { name: "node", type: "int", options: [0,1,2,3,4,5,6,7,8,9,10,12] } ],
|
|
|
+ params: [
|
|
|
+ { name: "node", type: "int", options: [0,1,2,3,4,5,6,7,8,9,10,12] },
|
|
|
+ { name: "node", type: "int", options: [0,-1,-2,-3,-4,-5,-6,-7], optional: true },
|
|
|
+ ],
|
|
|
defaultParams: [3]
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: 'substr',
|
|
|
+ category: categories.Special,
|
|
|
+ params: [
|
|
|
+ { name: "start", type: "int", options: [-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,12] },
|
|
|
+ { name: "stop", type: "int", options: [-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,12] },
|
|
|
+ ],
|
|
|
+ defaultParams: [0, 0]
|
|
|
+ });
|
|
|
+
|
|
|
addFuncDef({
|
|
|
name: 'sortByName',
|
|
|
category: categories.Special
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: 'sortByMaxima',
|
|
|
+ category: categories.Special
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'sortByMinima',
|
|
|
+ category: categories.Special
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'sortByTotal',
|
|
|
+ category: categories.Special
|
|
|
+ });
|
|
|
+
|
|
|
addFuncDef({
|
|
|
name: 'aliasByMetric',
|
|
|
category: categories.Special,
|
|
|
@@ -189,6 +247,13 @@ function (_) {
|
|
|
defaultParams: [10]
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: 'transformNull',
|
|
|
+ category: categories.Transform,
|
|
|
+ params: [ { name: "amount", type: "int", } ],
|
|
|
+ defaultParams: [0]
|
|
|
+ });
|
|
|
+
|
|
|
addFuncDef({
|
|
|
name: 'integral',
|
|
|
category: categories.Transform,
|
|
|
@@ -220,6 +285,13 @@ function (_) {
|
|
|
defaultParams: ['1h', 'sum']
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: 'smartSummarize',
|
|
|
+ category: categories.Transform,
|
|
|
+ params: [ { name: "interval", type: "string" }, { name: "func", type: "select", options: ['sum', 'avg', 'min', 'max', 'last'] }],
|
|
|
+ defaultParams: ['1h', 'sum']
|
|
|
+ });
|
|
|
+
|
|
|
addFuncDef({
|
|
|
name: 'absolute',
|
|
|
category: categories.Transform,
|
|
|
@@ -268,6 +340,41 @@ function (_) {
|
|
|
defaultParams: [25]
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: 'maximumAbove',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "value", type: "int" } ],
|
|
|
+ defaultParams: [0]
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'maximumBelow',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "value", type: "int" } ],
|
|
|
+ defaultParams: [0]
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'minimumAbove',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "value", type: "int" } ],
|
|
|
+ defaultParams: [0]
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'limit',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "n", type: "int" } ],
|
|
|
+ defaultParams: [5]
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'mostDeviant',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "n", type: "int" } ],
|
|
|
+ defaultParams: [10]
|
|
|
+ });
|
|
|
+
|
|
|
addFuncDef({
|
|
|
name: "exclude",
|
|
|
category: categories.Filter,
|
|
|
@@ -303,6 +410,20 @@ function (_) {
|
|
|
defaultParams: [10]
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: 'movingMedian',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "windowSize", type: "select", options: ['1min', '5min', '15min', '30min', '1hour'] } ],
|
|
|
+ defaultParams: ['1min']
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'stdev',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "n", type: "int" }, { name: "tolerance", type: "int" } ],
|
|
|
+ defaultParams: [5,0.1]
|
|
|
+ });
|
|
|
+
|
|
|
addFuncDef({
|
|
|
name: 'highestAverage',
|
|
|
category: categories.Filter,
|
|
|
@@ -317,6 +438,34 @@ function (_) {
|
|
|
defaultParams: [5]
|
|
|
});
|
|
|
|
|
|
+ addFuncDef({
|
|
|
+ name: 'removeAbovePercentile',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "n", type: "int" } ],
|
|
|
+ defaultParams: [5]
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'removeAboveValue',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "n", type: "int" } ],
|
|
|
+ defaultParams: [5]
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'removeBelowPercentile',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "n", type: "int" } ],
|
|
|
+ defaultParams: [5]
|
|
|
+ });
|
|
|
+
|
|
|
+ addFuncDef({
|
|
|
+ name: 'removeBelowValue',
|
|
|
+ category: categories.Filter,
|
|
|
+ params: [ { name: "n", type: "int" } ],
|
|
|
+ defaultParams: [5]
|
|
|
+ });
|
|
|
+
|
|
|
_.each(categories, function(funcList, catName) {
|
|
|
categories[catName] = _.sortBy(funcList, 'name');
|
|
|
});
|
|
|
@@ -340,9 +489,29 @@ function (_) {
|
|
|
return str + parameters.join(',') + ')';
|
|
|
};
|
|
|
|
|
|
+ FuncInstance.prototype._hasMultipleParamsInString = function(strValue, index) {
|
|
|
+ if (strValue.indexOf(',') === -1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.def.params[index + 1] && this.def.params[index + 1].optional;
|
|
|
+ };
|
|
|
+
|
|
|
FuncInstance.prototype.updateParam = function(strValue, index) {
|
|
|
- if (this.def.params[index].type === 'int') {
|
|
|
- this.params[index] = parseInt(strValue, 10);
|
|
|
+ // handle optional parameters
|
|
|
+ // if string contains ',' and next param is optional, split and update both
|
|
|
+ if (this._hasMultipleParamsInString(strValue, index)) {
|
|
|
+ _.each(strValue.split(','), function(partVal, idx) {
|
|
|
+ this.updateParam(partVal.trim(), idx);
|
|
|
+ }, this);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strValue === '' && this.def.params[index].optional) {
|
|
|
+ this.params.splice(index, 1);
|
|
|
+ }
|
|
|
+ else if (this.def.params[index].type === 'int') {
|
|
|
+ this.params[index] = parseFloat(strValue, 10);
|
|
|
}
|
|
|
else {
|
|
|
this.params[index] = strValue;
|
|
|
@@ -359,6 +528,10 @@ function (_) {
|
|
|
|
|
|
var text = this.def.name + '(';
|
|
|
_.each(this.def.params, function(param, index) {
|
|
|
+ if (param.optional && this.params[index] === undefined) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
text += this.params[index] + ', ';
|
|
|
}, this);
|
|
|
text = text.substring(0, text.length - 2);
|