diff --git a/rules/manager.go b/rules/manager.go index 3f4ce8d8b..110b64d55 100644 --- a/rules/manager.go +++ b/rules/manager.go @@ -595,13 +595,13 @@ func (g *Group) Eval(ctx context.Context, ts time.Time) { if err != nil { rule.SetHealth(HealthBad) rule.SetLastError(err) + g.metrics.evalFailures.WithLabelValues(GroupKey(g.File(), g.Name())).Inc() // Canceled queries are intentional termination of queries. This normally // happens on shutdown and thus we skip logging of any errors here. if _, ok := err.(promql.ErrQueryCanceled); !ok { level.Warn(g.logger).Log("msg", "Evaluating rule failed", "rule", rule, "err", err) } - g.metrics.evalFailures.WithLabelValues(GroupKey(g.File(), g.Name())).Inc() return } samplesTotal += float64(len(vector)) @@ -620,6 +620,7 @@ func (g *Group) Eval(ctx context.Context, ts time.Time) { if err := app.Commit(); err != nil { rule.SetHealth(HealthBad) rule.SetLastError(err) + g.metrics.evalFailures.WithLabelValues(GroupKey(g.File(), g.Name())).Inc() level.Warn(g.logger).Log("msg", "Rule sample appending failed", "err", err) return