diff --git a/dispatch/dispatch.go b/dispatch/dispatch.go index a024866d..88450b05 100644 --- a/dispatch/dispatch.go +++ b/dispatch/dispatch.go @@ -53,7 +53,11 @@ func NewDispatcherMetrics(r prometheus.Registerer) *DispatcherMetrics { }, ), } - prometheus.MustRegister(m.aggrGroups, m.processingDuration) + + if r != nil { + r.MustRegister(m.aggrGroups, m.processingDuration) + } + return &m }