mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 04:55:22 +00:00
add new metrics (gauges): backup_total and restore_total
Signed-off-by: fabito <fuechi@ciandt.com>
This commit is contained in:
@@ -111,6 +111,8 @@ func NewBackupController(
|
||||
backupLocationInformer.Informer().HasSynced,
|
||||
volumeSnapshotLocationInformer.Informer().HasSynced,
|
||||
)
|
||||
c.resyncFunc = c.resync
|
||||
c.resyncPeriod = time.Minute
|
||||
|
||||
backupInformer.Informer().AddEventHandler(
|
||||
cache.ResourceEventHandlerFuncs{
|
||||
@@ -141,6 +143,15 @@ func NewBackupController(
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *backupController) resync() {
|
||||
backups, err := c.lister.List(labels.Everything())
|
||||
if err != nil {
|
||||
c.logger.Error(err, "Error computing backup_total metric")
|
||||
} else {
|
||||
c.metrics.SetBackupTotal(int64(len(backups)))
|
||||
}
|
||||
}
|
||||
|
||||
func (c *backupController) processBackup(key string) error {
|
||||
log := c.logger.WithField("key", key)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user