PR for #562: fix merge conflicts

This commit is contained in:
Alexander Zobnin
2019-02-13 13:44:12 +03:00
2 changed files with 57 additions and 0 deletions

View File

@@ -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) {
return _.orderBy(timeseries, [function (ts) {
return ts.target.toLowerCase();
@@ -123,6 +150,7 @@ let metricFunctions = {
rate: rate,
movingAverage: simpleMovingAverage,
exponentialMovingAverage: expMovingAverage,
transformNull: transformNull,
aggregateBy: aggregateByWrapper,
// Predefined aggs
percentil: percentil,
@@ -133,6 +161,8 @@ let metricFunctions = {
sum: _.partial(aggregateWrapper, SUM),
count: _.partial(aggregateWrapper, COUNT),
sumSeries: sumSeries,
removeAboveValue: removeAboveValue,
removeBelowValue: removeBelowValue,
top: _.partial(limit, 'top'),
bottom: _.partial(limit, 'bottom'),
sortSeries: sortSeries,