From 707228782ded56b2b52a30f7b848576193cbc3be Mon Sep 17 00:00:00 2001 From: Sean Hanson Date: Thu, 18 Jan 2018 13:35:38 -0500 Subject: [PATCH 1/2] Update docs and add implemented functions --- docs/graphite.md | 8 +++++++- expr/funcs.go | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/graphite.md b/docs/graphite.md index 9786f30a4f..473c05b766 100644 --- a/docs/graphite.md +++ b/docs/graphite.md @@ -30,14 +30,20 @@ Here are the currently included functions: Function name and signature | Alias | Metrictank ----------------------------------------------------- | ------------ | ---------- alias(seriesList, alias) seriesList | | Stable -aliasByNode(seriesList, nodeList) seriesList | | Stable +aliasByNode(seriesList, nodeList) seriesList | aliasByTags | Stable aliasSub(seriesList, pattern, replacement) seriesList | | Stable averageSeries(seriesLists) series | avg | Stable consolidateBy(seriesList, func) seriesList | | Stable +diffSeries(seriesLists) series | diff | Stable divideSeries(seriesList, dividend, divisor) seriesList| | Stable +groupByTags(seriesList, func, tagList) seriesList | | Stable maxSeries(seriesList) series | max | Stable +minSeries(seriesList) series | min | Stable +multiplySeries(seriesList) series | multiply | Stable movingAverage(seriesLists, windowSize) seriesList | | Unstable perSecond(seriesLists) seriesList | | Stable +rangeOfSeries(seriesList) series | rangeOf | Stable scale(seriesLists, num) series | sum | Stable +stddevSeries(seriesList) series | stddev | Stable sumSeries(seriesLists) series | sum | Stable transformNull(seriesList, default=0) seriesList | | Stable diff --git a/expr/funcs.go b/expr/funcs.go index e28667b334..88c57e3386 100644 --- a/expr/funcs.go +++ b/expr/funcs.go @@ -53,16 +53,24 @@ func init() { "avg": {NewAggregateConstructor("average", crossSeriesAvg), true}, "averageSeries": {NewAggregateConstructor("average", crossSeriesAvg), true}, "consolidateBy": {NewConsolidateBy, true}, + "diff": {NewAggregateConstructor("diff", crossSeriesDiff), true}, + "diffSeries": {NewAggregateConstructor("diff", crossSeriesDiff), true}, "divideSeries": {NewDivideSeries, true}, "groupByTags": {NewGroupByTags, true}, "max": {NewAggregateConstructor("max", crossSeriesMax), true}, "maxSeries": {NewAggregateConstructor("max", crossSeriesMax), true}, "min": {NewAggregateConstructor("min", crossSeriesMin), true}, "minSeries": {NewAggregateConstructor("min", crossSeriesMin), true}, + "multiply": {NewAggregateConstructor("multiply", crossSeriesMultiply), true}, + "multiplySeries": {NewAggregateConstructor("multiply", crossSeriesMultiply), true}, "movingAverage": {NewMovingAverage, false}, "perSecond": {NewPerSecond, true}, + "rangeOf": {NewAggregateConstructor("rangeOf", crossSeriesRange), true}, + "rangeOfSeries": {NewAggregateConstructor("rangeOf", crossSeriesRange), true}, "scale": {NewScale, true}, "smartSummarize": {NewSmartSummarize, false}, + "stddev": {NewAggregateConstructor("stddev", crossSeriesStddev), true}, + "stddevSeries": {NewAggregateConstructor("stddev", crossSeriesStddev), true}, "sum": {NewAggregateConstructor("sum", crossSeriesSum), true}, "sumSeries": {NewAggregateConstructor("sum", crossSeriesSum), true}, "transformNull": {NewTransformNull, true}, From 20a691effdb3cffa7b20ce5562c1fd5da0d0f073 Mon Sep 17 00:00:00 2001 From: Sean Hanson Date: Thu, 18 Jan 2018 14:04:47 -0500 Subject: [PATCH 2/2] Add in some more of the already implemented functions --- docs/graphite.md | 10 +++++----- expr/funcs.go | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/docs/graphite.md b/docs/graphite.md index 473c05b766..719a4bb8b5 100644 --- a/docs/graphite.md +++ b/docs/graphite.md @@ -34,16 +34,16 @@ aliasByNode(seriesList, nodeList) seriesList | aliasByTags | Stable aliasSub(seriesList, pattern, replacement) seriesList | | Stable averageSeries(seriesLists) series | avg | Stable consolidateBy(seriesList, func) seriesList | | Stable -diffSeries(seriesLists) series | diff | Stable +diffSeries(seriesLists) series | | Stable divideSeries(seriesList, dividend, divisor) seriesList| | Stable groupByTags(seriesList, func, tagList) seriesList | | Stable maxSeries(seriesList) series | max | Stable minSeries(seriesList) series | min | Stable -multiplySeries(seriesList) series | multiply | Stable +multiplySeries(seriesList) series | | Stable movingAverage(seriesLists, windowSize) seriesList | | Unstable perSecond(seriesLists) seriesList | | Stable -rangeOfSeries(seriesList) series | rangeOf | Stable -scale(seriesLists, num) series | sum | Stable -stddevSeries(seriesList) series | stddev | Stable +rangeOfSeries(seriesList) series | | Stable +scale(seriesLists, num) series | | Stable +stddevSeries(seriesList) series | | Stable sumSeries(seriesLists) series | sum | Stable transformNull(seriesList, default=0) seriesList | | Stable diff --git a/expr/funcs.go b/expr/funcs.go index 88c57e3386..468424af39 100644 --- a/expr/funcs.go +++ b/expr/funcs.go @@ -53,7 +53,6 @@ func init() { "avg": {NewAggregateConstructor("average", crossSeriesAvg), true}, "averageSeries": {NewAggregateConstructor("average", crossSeriesAvg), true}, "consolidateBy": {NewConsolidateBy, true}, - "diff": {NewAggregateConstructor("diff", crossSeriesDiff), true}, "diffSeries": {NewAggregateConstructor("diff", crossSeriesDiff), true}, "divideSeries": {NewDivideSeries, true}, "groupByTags": {NewGroupByTags, true}, @@ -61,15 +60,12 @@ func init() { "maxSeries": {NewAggregateConstructor("max", crossSeriesMax), true}, "min": {NewAggregateConstructor("min", crossSeriesMin), true}, "minSeries": {NewAggregateConstructor("min", crossSeriesMin), true}, - "multiply": {NewAggregateConstructor("multiply", crossSeriesMultiply), true}, "multiplySeries": {NewAggregateConstructor("multiply", crossSeriesMultiply), true}, "movingAverage": {NewMovingAverage, false}, "perSecond": {NewPerSecond, true}, - "rangeOf": {NewAggregateConstructor("rangeOf", crossSeriesRange), true}, "rangeOfSeries": {NewAggregateConstructor("rangeOf", crossSeriesRange), true}, "scale": {NewScale, true}, "smartSummarize": {NewSmartSummarize, false}, - "stddev": {NewAggregateConstructor("stddev", crossSeriesStddev), true}, "stddevSeries": {NewAggregateConstructor("stddev", crossSeriesStddev), true}, "sum": {NewAggregateConstructor("sum", crossSeriesSum), true}, "sumSeries": {NewAggregateConstructor("sum", crossSeriesSum), true},