From 828b79fb99370b7a539bc1487f91f8981951d2e4 Mon Sep 17 00:00:00 2001 From: Raunak Pradip Shah Date: Wed, 28 Sep 2022 15:08:41 +0530 Subject: [PATCH] Use metrics exposed by sig-storage-lib --- cmd/csi-provisioner/csi-provisioner.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/csi-provisioner/csi-provisioner.go b/cmd/csi-provisioner/csi-provisioner.go index 01b1f543c3..654bc21cac 100644 --- a/cmd/csi-provisioner/csi-provisioner.go +++ b/cmd/csi-provisioner/csi-provisioner.go @@ -54,6 +54,7 @@ import ( csitrans "k8s.io/csi-translation-lib" "k8s.io/klog/v2" "sigs.k8s.io/sig-storage-lib-external-provisioner/v8/controller" + libmetrics "sigs.k8s.io/sig-storage-lib-external-provisioner/v8/controller/metrics" "github.com/kubernetes-csi/csi-lib-utils/leaderelection" "github.com/kubernetes-csi/csi-lib-utils/metrics" @@ -551,6 +552,14 @@ func main() { // To collect metrics data from the metric handler itself, we // let it register itself and then collect from that registry. reg := prometheus.NewRegistry() + reg.MustRegister([]prometheus.Collector{ + libmetrics.PersistentVolumeClaimProvisionTotal, + libmetrics.PersistentVolumeClaimProvisionFailedTotal, + libmetrics.PersistentVolumeClaimProvisionDurationSeconds, + libmetrics.PersistentVolumeDeleteTotal, + libmetrics.PersistentVolumeDeleteFailedTotal, + libmetrics.PersistentVolumeDeleteDurationSeconds, + }...) gatherers = append(gatherers, reg) // This is similar to k8s.io/component-base/metrics HandlerWithReset