diff --git a/changelogs/unreleased/7445-allenxu404 b/changelogs/unreleased/7445-allenxu404 new file mode 100644 index 0000000000..051ff2e68a --- /dev/null +++ b/changelogs/unreleased/7445-allenxu404 @@ -0,0 +1 @@ +Adjust the logic for the backup_last_status metrics to stop incorrectly incrementing over time \ No newline at end of file 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)