diff --git a/metrics/metrics.go b/metrics/metrics.go index 3baab8ca7..e90de2c51 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -179,6 +179,13 @@ func WithProcessStartTime(registerProcessStartTime bool) MetricsManagerOption { } } +// WithCustomRegistry allow user to use custom pre-created registry instead of a new created one. +func WithCustomRegistry(registry metrics.KubeRegistry) MetricsManagerOption { + return func(cmm *csiMetricsManager) { + cmm.registry = registry + } +} + // NewCSIMetricsManagerForSidecar creates and registers metrics for CSI Sidecars and // returns an object that can be used to trigger the metrics. It uses "csi_sidecar" // as subsystem.