diff --git a/pkg/services/ngalert/schedule/recording_rule_test.go b/pkg/services/ngalert/schedule/recording_rule_test.go index 416489f5ccc..c46144c6d58 100644 --- a/pkg/services/ngalert/schedule/recording_rule_test.go +++ b/pkg/services/ngalert/schedule/recording_rule_test.go @@ -482,8 +482,8 @@ func TestRecordingRule_Integration(t *testing.T) { t.Run("status shows evaluation", func(t *testing.T) { status := process.(*recordingRule).Status() - // TODO: OK expected for nil result but having a point. Probably should change. - require.Equal(t, "ok", status.Health) + //TODO: assert "error" to fix test, update to "nodata" in the future + require.Equal(t, "error", status.Health) }) }) } diff --git a/pkg/services/ngalert/writer/prom.go b/pkg/services/ngalert/writer/prom.go index 2a0637c9d73..b01baf5197e 100644 --- a/pkg/services/ngalert/writer/prom.go +++ b/pkg/services/ngalert/writer/prom.go @@ -3,7 +3,6 @@ package writer import ( "context" "fmt" - "math" "net/http" "net/url" "strings" @@ -63,15 +62,14 @@ func PointsFromFrames(name string, t time.Time, frames data.Frames, extraLabels points := make([]Point, 0, len(col.Refs)) for _, ref := range col.Refs { - // Use a default value of NaN if the value is empty or nil. - f := math.NaN() - if fp, empty, _ := ref.NullableFloat64Value(); !empty && fp != nil { - f = *fp + fp, empty, _ := ref.NullableFloat64Value() + if empty || fp == nil { + return nil, fmt.Errorf("unable to read float64 value") } metric := Metric{ T: t, - V: f, + V: *fp, } labels := ref.GetLabels().Copy()