Skip to content

Commit

Permalink
Alerting/SSE: Fix "count_non_null" reducer validation (#35451)
Browse files Browse the repository at this point in the history
fixes error "reducer 'count_non_null' in condition 2 is not a valid reducer"
  • Loading branch information
kylebrandt committed Jun 9, 2021
1 parent 4b8d796 commit f4e9dcd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/expr/classic/reduce.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func (cr classicReducer) ValidReduceFunc() bool {
switch cr {
case "avg", "sum", "min", "max", "count", "last", "median":
return true
case "diff", "diff_abs", "percent_diff", "percent_diff_abs", "count_not_null":
case "diff", "diff_abs", "percent_diff", "percent_diff_abs", "count_non_null":
return true
}
return false
Expand Down
1 change: 1 addition & 0 deletions pkg/expr/classic/reduce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func TestReducer(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require.Equal(t, true, tt.reducer.ValidReduceFunc())
num := tt.reducer.Reduce(tt.inputSeries)
require.Equal(t, tt.expectedNumber, num)
})
Expand Down

0 comments on commit f4e9dcd

Please sign in to comment.