Skip to content

Commit

Permalink
Modify CSI VolumeSnapshot metric related code.
Browse files Browse the repository at this point in the history
Signed-off-by: Xun Jiang <[email protected]>
  • Loading branch information
Xun Jiang committed Apr 21, 2022
1 parent 3ec96e2 commit 524c9b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/controller/backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ func (c *backupController) runBackup(backup *pkgbackup.Request) error {
if err != nil {
backupLog.Error(err)
}

backup.CSISnapshots = volumeSnapshots
}

if c.volumeSnapshotContentLister != nil {
Expand Down
9 changes: 9 additions & 0 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,15 @@ func (m *ServerMetrics) InitSchedule(scheduleName string) {
if c, ok := m.metrics[volumeSnapshotFailureTotal].(*prometheus.CounterVec); ok {
c.WithLabelValues(scheduleName).Add(0)
}
if c, ok := m.metrics[csiSnapshotAttemptTotal].(*prometheus.CounterVec); ok {
c.WithLabelValues(scheduleName, "").Add(0)
}
if c, ok := m.metrics[csiSnapshotSuccessTotal].(*prometheus.CounterVec); ok {
c.WithLabelValues(scheduleName, "").Add(0)
}
if c, ok := m.metrics[csiSnapshotFailureTotal].(*prometheus.CounterVec); ok {
c.WithLabelValues(scheduleName, "").Add(0)
}
}

// InitSchedule initializes counter metrics for a node.
Expand Down

0 comments on commit 524c9b1

Please sign in to comment.