Skip to content

Commit

Permalink
Merge pull request #792 from RaunakShah/use_metrics_all
Browse files Browse the repository at this point in the history
Register metrics exposed by sig-storage-lib
  • Loading branch information
k8s-ci-robot authored Sep 29, 2022
2 parents 4567a81 + 828b79f commit 116bbca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/csi-provisioner/csi-provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 116bbca

Please sign in to comment.