dskit
dskit copied to clipboard
Avoid using promauto for metrics registration
Recently, https://github.com/grafana/dskit/pull/342 migrated packages from weaveworks/common to dskit.
One of the changes was to replaced the use of prometheus with promauto which in cases of downstream users who try to instantiate multiple instances of objects (eg. due to configuration reloads) triggers "duplicate metrics collector registration attempted" panics, for example here and here.
We should allow downstream consumers of packages to pass in their own Prometheus registerers for these metrics, or default to the global one if nil is passed.
Avoid using promauto for metrics registration
Let's use promauto.With(reg)... with supplied registrerer.
More detail required on why you think promauto is involved.
Most of the errors you point to don't even include dskit in the stack.