PR for #562: fix merge conflicts
This commit is contained in:
@@ -37,6 +37,33 @@ function limit(order, n, orderByFunc, timeseries) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeAboveValue(n, datapoints) {
|
||||||
|
return _.map(datapoints, point => {
|
||||||
|
return [
|
||||||
|
(point[0] > n) ? null : point[0],
|
||||||
|
point[1]
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeBelowValue(n, datapoints) {
|
||||||
|
return _.map(datapoints, point => {
|
||||||
|
return [
|
||||||
|
(point[0] < n) ? null : point[0],
|
||||||
|
point[1]
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformNull(n, datapoints) {
|
||||||
|
return _.map(datapoints, point => {
|
||||||
|
return [
|
||||||
|
(point[0] !== null) ? point[0] : n,
|
||||||
|
point[1]
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function sortSeries(direction, timeseries) {
|
function sortSeries(direction, timeseries) {
|
||||||
return _.orderBy(timeseries, [function (ts) {
|
return _.orderBy(timeseries, [function (ts) {
|
||||||
return ts.target.toLowerCase();
|
return ts.target.toLowerCase();
|
||||||
@@ -123,6 +150,7 @@ let metricFunctions = {
|
|||||||
rate: rate,
|
rate: rate,
|
||||||
movingAverage: simpleMovingAverage,
|
movingAverage: simpleMovingAverage,
|
||||||
exponentialMovingAverage: expMovingAverage,
|
exponentialMovingAverage: expMovingAverage,
|
||||||
|
transformNull: transformNull,
|
||||||
aggregateBy: aggregateByWrapper,
|
aggregateBy: aggregateByWrapper,
|
||||||
// Predefined aggs
|
// Predefined aggs
|
||||||
percentil: percentil,
|
percentil: percentil,
|
||||||
@@ -133,6 +161,8 @@ let metricFunctions = {
|
|||||||
sum: _.partial(aggregateWrapper, SUM),
|
sum: _.partial(aggregateWrapper, SUM),
|
||||||
count: _.partial(aggregateWrapper, COUNT),
|
count: _.partial(aggregateWrapper, COUNT),
|
||||||
sumSeries: sumSeries,
|
sumSeries: sumSeries,
|
||||||
|
removeAboveValue: removeAboveValue,
|
||||||
|
removeBelowValue: removeBelowValue,
|
||||||
top: _.partial(limit, 'top'),
|
top: _.partial(limit, 'top'),
|
||||||
bottom: _.partial(limit, 'bottom'),
|
bottom: _.partial(limit, 'bottom'),
|
||||||
sortSeries: sortSeries,
|
sortSeries: sortSeries,
|
||||||
|
|||||||
@@ -85,6 +85,15 @@ addFuncDef({
|
|||||||
defaultParams: [0.2],
|
defaultParams: [0.2],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addFuncDef({
|
||||||
|
name: 'transformNull',
|
||||||
|
category: 'Transform',
|
||||||
|
params: [
|
||||||
|
{name: 'number', type: 'float'}
|
||||||
|
],
|
||||||
|
defaultParams: [0],
|
||||||
|
});
|
||||||
|
|
||||||
// Aggregate
|
// Aggregate
|
||||||
|
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
@@ -170,6 +179,24 @@ addFuncDef({
|
|||||||
|
|
||||||
// Filter
|
// Filter
|
||||||
|
|
||||||
|
addFuncDef({
|
||||||
|
name: 'removeAboveValue',
|
||||||
|
category: 'Filter',
|
||||||
|
params: [
|
||||||
|
{name: 'number', type: 'float'},
|
||||||
|
],
|
||||||
|
defaultParams: [0],
|
||||||
|
});
|
||||||
|
|
||||||
|
addFuncDef({
|
||||||
|
name: 'removeBelowValue',
|
||||||
|
category: 'Filter',
|
||||||
|
params: [
|
||||||
|
{name: 'number', type: 'float'},
|
||||||
|
],
|
||||||
|
defaultParams: [0],
|
||||||
|
});
|
||||||
|
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'top',
|
name: 'top',
|
||||||
category: 'Filter',
|
category: 'Filter',
|
||||||
|
|||||||
Reference in New Issue
Block a user