-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
We have a number of custom collectors that wrap other collectors - e.g. some cached value is periodically refreshed, where we want to collect metrics about the last refresh time, and also metrics about the value itself.
Currently for the outer collector to add a label or metric to the inner collector, we either need to reimplement wrappingCollector
ourselves, or we need to also apply the labels to the outer collector when it's registered using e.g. WrapRegistererWith
, in turn leading to some ugly patterns like
{
r := prometheus.WrapRegistererWith(labels, prometheus.DefaultRegisterer)
r.MustRegister(c)
defer r.Unregister(c)
}
repeated for every collector with different labels.
With a public wrappingCollector
we could avoid this by either wrapping it at the layer between the outer and inner collector.