Alerting: Add doc comments to classic.go (#56724)
This commit is contained in:
@@ -7,11 +7,9 @@ import (
|
||||
"github.com/grafana/grafana/pkg/expr/mathexp"
|
||||
)
|
||||
|
||||
func nilOrNaN(f *float64) bool {
|
||||
return f == nil || math.IsNaN(*f)
|
||||
}
|
||||
type reducer string
|
||||
|
||||
func (cr classicReducer) ValidReduceFunc() bool {
|
||||
func (cr reducer) ValidReduceFunc() bool {
|
||||
switch cr {
|
||||
case "avg", "sum", "min", "max", "count", "last", "median":
|
||||
return true
|
||||
@@ -22,7 +20,7 @@ func (cr classicReducer) ValidReduceFunc() bool {
|
||||
}
|
||||
|
||||
//nolint:gocyclo
|
||||
func (cr classicReducer) Reduce(series mathexp.Series) mathexp.Number {
|
||||
func (cr reducer) Reduce(series mathexp.Series) mathexp.Number {
|
||||
num := mathexp.NewNumber("", nil)
|
||||
|
||||
if series.GetLabels() != nil {
|
||||
@@ -184,6 +182,10 @@ func calculateDiff(ff mathexp.Float64Field, allNull bool, value float64, fn func
|
||||
return allNull, value
|
||||
}
|
||||
|
||||
func nilOrNaN(f *float64) bool {
|
||||
return f == nil || math.IsNaN(*f)
|
||||
}
|
||||
|
||||
var diff = func(newest, oldest float64) float64 {
|
||||
return newest - oldest
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user