add new counter metrics for backup deletion (#1280)

* compute backup deletion metrics (attempt, success, fail)

Signed-off-by: fabito <fuechi@ciandt.com>
This commit is contained in:
Fábio Franco Uechi
2019-04-04 15:25:59 -03:00
committed by Nolan Brubaker
parent 985479094f
commit 0167539a14
5 changed files with 76 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ import (
pkgbackup "github.com/heptio/velero/pkg/backup"
"github.com/heptio/velero/pkg/generated/clientset/versioned/fake"
informers "github.com/heptio/velero/pkg/generated/informers/externalversions"
"github.com/heptio/velero/pkg/metrics"
"github.com/heptio/velero/pkg/persistence"
persistencemocks "github.com/heptio/velero/pkg/persistence/mocks"
"github.com/heptio/velero/pkg/plugin/clientmgmt"
@@ -61,6 +62,7 @@ func TestBackupDeletionControllerProcessQueueItem(t *testing.T) {
sharedInformers.Velero().V1().BackupStorageLocations(),
sharedInformers.Velero().V1().VolumeSnapshotLocations(),
nil, // new plugin manager func
metrics.NewServerMetrics(),
).(*backupDeletionController)
// Error splitting key
@@ -147,6 +149,7 @@ func setupBackupDeletionControllerTest(objects ...runtime.Object) *backupDeletio
sharedInformers.Velero().V1().BackupStorageLocations(),
sharedInformers.Velero().V1().VolumeSnapshotLocations(),
func(logrus.FieldLogger) clientmgmt.Manager { return pluginManager },
metrics.NewServerMetrics(),
).(*backupDeletionController),
req: req,
@@ -723,6 +726,7 @@ func TestBackupDeletionControllerDeleteExpiredRequests(t *testing.T) {
sharedInformers.Velero().V1().BackupStorageLocations(),
sharedInformers.Velero().V1().VolumeSnapshotLocations(),
nil, // new plugin manager func
metrics.NewServerMetrics(),
).(*backupDeletionController)
fakeClock := &clock.FakeClock{}