diff --git a/src/query/graphite/native/aggregation_functions.go b/src/query/graphite/native/aggregation_functions.go index 60c7691ce8..cae4abe929 100644 --- a/src/query/graphite/native/aggregation_functions.go +++ b/src/query/graphite/native/aggregation_functions.go @@ -146,14 +146,24 @@ func aggregate(ctx *common.Context, series singlePathSpec, fname string) (ts.Ser case Max, MaxSeries: return maxSeries(ctx, multiplePathSpecs(series)) case Avg, Average, AverageSeries: - return averageSeries(ctx,multiplePathSpecs(series)) + return averageSeries(ctx, multiplePathSpecs(series)) case Multiply, MultiplySeries: return multiplySeries(ctx, multiplePathSpecs(series)) case Diff, DiffSeries: return diffSeries(ctx, multiplePathSpecs(series)) case Count, CountSeries: return countSeries(ctx, multiplePathSpecs(series)) + case Range, RangeOf, RangeOfSeries: + return rangeOfSeries(ctx, series) + case Last, KeepLastValue: + return keepLastValue(ctx, series, -1) // using default value, same as graphite-web python implementation. + case Stdev, Stddev: + // default value for points in python implementation not clear, using an arbitrary 5 data points value should works fine. + // default value for null value ratio is same as graphite-web python implementation. + return stdev(ctx, series, 5, 0.1) default: + // Median: the movingMedian() method already implemented is returning an series non compatible result. skip support for now. + // avg_zero is not implemented, skip support for now unless later identified actual use cases. return ts.NewSeriesList(), errors.NewInvalidParamsError(fmt.Errorf("invalid func %s", fname)) } } diff --git a/src/query/graphite/native/functions.go b/src/query/graphite/native/functions.go index a812ad2c63..ba7edc1765 100644 --- a/src/query/graphite/native/functions.go +++ b/src/query/graphite/native/functions.go @@ -39,6 +39,7 @@ var ( funcMut sync.RWMutex functions = map[string]*Function{} ) + // list of graphite function name strings. (not whole list, update on-demand) const ( Average = "average" @@ -49,12 +50,19 @@ const ( Diff = "diff" DiffSeries = "diffSeries" Empty = "" + Last = "last" + KeepLastValue = "keepLastValue" Max = "max" MaxSeries = "maxSeries" Min = "min" MinSeries = "minSeries" Multiply = "multiply" MultiplySeries = "multiplySeries" + Range = "range" + RangeOf = "rangeOf" + RangeOfSeries = "rangeOfSeries" + Stdev = "stdev" + Stddev = "stddev" Sum = "sum" SumSeries = "sumSeries" Total = "total"