diff --git a/server/server.go b/server/server.go index 17a55b47..492598b8 100644 --- a/server/server.go +++ b/server/server.go @@ -104,6 +104,9 @@ func New(cfg Config) (*Server, error) { Help: "Time (in seconds) spent serving HTTP requests.", Buckets: instrument.DefBuckets, }, []string{"method", "route", "status_code", "ws"}) + // Try to unregister the requestDuration, in case already registered for some reason, + // e.g. double initialisation/configuration done by mistake by the end-user. + prometheus.Unregister(requestDuration) prometheus.MustRegister(requestDuration) // If user doesn't supply a logging implementation, by default instantiate