mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 11:45:20 +00:00
Add backupValidationFailureTotal to metrics (#2714)
* Add backValidationFailureTotal to metrics Signed-off-by: Kathrin Mao <kathrin.mao@sap.com>
This commit is contained in:
1
changelogs/unreleased/2714-kathpeony
Normal file
1
changelogs/unreleased/2714-kathpeony
Normal file
@@ -0,0 +1 @@
|
||||
Add backupValidationFailureTotal to metrics
|
||||
@@ -287,6 +287,8 @@ func (c *backupController) processBackup(key string) error {
|
||||
c.metrics.RegisterBackupPartialFailure(backupScheduleName)
|
||||
case velerov1api.BackupPhaseFailed:
|
||||
c.metrics.RegisterBackupFailed(backupScheduleName)
|
||||
case velerov1api.BackupPhaseFailedValidation:
|
||||
c.metrics.RegisterBackupValidationFailure(backupScheduleName)
|
||||
}
|
||||
|
||||
log.Debug("Updating backup's final status")
|
||||
|
||||
@@ -35,6 +35,7 @@ const (
|
||||
backupSuccessTotal = "backup_success_total"
|
||||
backupPartialFailureTotal = "backup_partial_failure_total"
|
||||
backupFailureTotal = "backup_failure_total"
|
||||
backupValidationFailureTotal = "backup_validation_failure_total"
|
||||
backupDurationSeconds = "backup_duration_seconds"
|
||||
backupDeletionAttemptTotal = "backup_deletion_attempt_total"
|
||||
backupDeletionSuccessTotal = "backup_deletion_success_total"
|
||||
@@ -115,6 +116,14 @@ func NewServerMetrics() *ServerMetrics {
|
||||
},
|
||||
[]string{scheduleLabel},
|
||||
),
|
||||
backupValidationFailureTotal: prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: metricNamespace,
|
||||
Name: backupValidationFailureTotal,
|
||||
Help: "Total number of validation failed backups",
|
||||
},
|
||||
[]string{scheduleLabel},
|
||||
),
|
||||
backupDeletionAttemptTotal: prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: metricNamespace,
|
||||
@@ -254,6 +263,9 @@ func (m *ServerMetrics) InitSchedule(scheduleName string) {
|
||||
if c, ok := m.metrics[backupFailureTotal].(*prometheus.CounterVec); ok {
|
||||
c.WithLabelValues(scheduleName).Add(0)
|
||||
}
|
||||
if c, ok := m.metrics[backupValidationFailureTotal].(*prometheus.CounterVec); ok {
|
||||
c.WithLabelValues(scheduleName).Add(0)
|
||||
}
|
||||
if c, ok := m.metrics[backupDeletionAttemptTotal].(*prometheus.CounterVec); ok {
|
||||
c.WithLabelValues(scheduleName).Add(0)
|
||||
}
|
||||
@@ -339,6 +351,13 @@ func (m *ServerMetrics) RegisterBackupFailed(backupSchedule string) {
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterBackupValidationFailure records a validation failed backup.
|
||||
func (m *ServerMetrics) RegisterBackupValidationFailure(backupSchedule string) {
|
||||
if c, ok := m.metrics[backupValidationFailureTotal].(*prometheus.CounterVec); ok {
|
||||
c.WithLabelValues(backupSchedule).Inc()
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterBackupDuration records the number of seconds a backup took.
|
||||
func (m *ServerMetrics) RegisterBackupDuration(backupSchedule string, seconds float64) {
|
||||
if c, ok := m.metrics[backupDurationSeconds].(*prometheus.HistogramVec); ok {
|
||||
|
||||
Reference in New Issue
Block a user