From 10909b671741e01886e9794d448204e00418b826 Mon Sep 17 00:00:00 2001 From: allenxu404 Date: Tue, 20 Feb 2024 17:12:24 +0800 Subject: [PATCH] Adjust the logic for the backup_last_status metric to stop incorrectly incrementing over time Signed-off-by: allenxu404 --- pkg/metrics/metrics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index b1bcaf765a..61b91812d8 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -468,7 +468,7 @@ func (m *ServerMetrics) InitSchedule(scheduleName string) { c.WithLabelValues(scheduleName).Add(0) } if c, ok := m.metrics[backupLastStatus].(*prometheus.GaugeVec); ok { - c.WithLabelValues(scheduleName).Add(1) + c.WithLabelValues(scheduleName).Set(float64(1)) } if c, ok := m.metrics[restoreAttemptTotal].(*prometheus.CounterVec); ok { c.WithLabelValues(scheduleName).Add(0)