Adjust the logic for the backup_last_status metrics to stop incorrectly incrementing over time

Signed-off-by: allenxu404 <qix2@vmware.com>
This commit is contained in:
allenxu404
2024-02-20 17:12:24 +08:00
parent d45b313f07
commit 84fb88c19c
2 changed files with 2 additions and 1 deletions

View File

@@ -0,0 +1 @@
Adjust the logic for the backup_last_status metrics to stop incorrectly incrementing over time

View File

@@ -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)