Skip to content

Commit

Permalink
aggregate: function should register all short forms as an alias
Browse files Browse the repository at this point in the history
 * This allows groupByNode/groupByNodes to call all available summarizer functions

Fixes #466
  • Loading branch information
Civil committed May 17, 2020
1 parent 9a825ee commit 7643c0c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion expr/functions/aggregate/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ func New(configFile string) []interfaces.FunctionMetadata {
for _, n := range []string{"aggregate"} {
res = append(res, interfaces.FunctionMetadata{Name: n, F: f})
}

// Also register aliases for each and every summarizer
for _, n := range consolidations.AvailableSummarizers {
res = append(res, interfaces.FunctionMetadata{Name: n, F: f})
}
return res
}

Expand All @@ -36,7 +41,11 @@ func (f *aggregate) Do(e parser.Expr, from, until int64, values map[parser.Metri

callback, err := e.GetStringArg(1)
if err != nil {
return nil, err
if e.Target() == "aggregate" {
return nil, err
} else {
callback = e.Target()
}
}

// TODO: Implement xFilesFactor
Expand Down
5 changes: 3 additions & 2 deletions expr/functions/diffSeries/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package diffSeries

import (
"fmt"
"math"
"strings"

"github.com/go-graphite/carbonapi/expr/helper"
"github.com/go-graphite/carbonapi/expr/interfaces"
"github.com/go-graphite/carbonapi/expr/types"
"github.com/go-graphite/carbonapi/pkg/parser"
"math"
"strings"
)

type diffSeries struct {
Expand Down

0 comments on commit 7643c0c

Please sign in to comment.