From 1f77f320a72f5f4bfd2e224ff1bd7bd8d98bc36c Mon Sep 17 00:00:00 2001 From: Marco Pracucci Date: Fri, 6 Mar 2020 15:09:30 +0100 Subject: [PATCH] Fixed dispatcher metrics registration Signed-off-by: Marco Pracucci --- dispatch/dispatch.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 }