Skip to content

Commit

Permalink
Added Sum stat resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
codebien committed Nov 29, 2022
1 parent 616e5e2 commit 17415ca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions metrics/sample.go
Expand Up @@ -145,6 +145,7 @@ func GetResolversForTrendColumns(trendColumns []string) (map[string]func(s *Tren
"med": func(s *TrendSink) float64 { return s.P(0.5) },
"max": func(s *TrendSink) float64 { return s.Max },
"count": func(s *TrendSink) float64 { return float64(s.Count) },
"sum": func(s *TrendSink) float64 { return s.Sum },
}
dynamicResolver := func(percentile float64) func(s *TrendSink) float64 {
return func(s *TrendSink) float64 {
Expand Down
2 changes: 1 addition & 1 deletion metrics/sample_test.go
Expand Up @@ -42,7 +42,7 @@ func TestGetResolversForTrendColumnsValidation(t *testing.T) {
expErr bool
}{
{[]string{}, false},
{[]string{"avg", "min", "med", "max", "p(0)", "p(99)", "p(99.999)", "count"}, false},
{[]string{"avg", "min", "med", "max", "p(0)", "p(99)", "p(99.999)", "count", "sum"}, false},
{[]string{"avg", "p(err)"}, true},
{[]string{"nil", "p(err)"}, true},
{[]string{"p90"}, true},
Expand Down
2 changes: 1 addition & 1 deletion metrics/value_type.go
Expand Up @@ -5,7 +5,7 @@ import "errors"
// Possible values for ValueType.
const (
Default = ValueType(iota) // Values are presented as-is
Time // Values are timestamps (nanoseconds)
Time // Values are timestamps (milliseconds)
Data // Values are data amounts (bytes)
)

Expand Down

0 comments on commit 17415ca

Please sign in to comment.