You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the additions to the promauto package in #713 , the need for MustRegister is diminished: Whoever doesn't care about panicking, can and should use promauto constructors, no matter if they want the local or the global registry. Whoever wants to play safe, won't use MustRegister anyway. With the notable exception of custom collectors. One might argue that those are rare enough to get registered with the normal Register call and subsequent error handling (even if it is just a panic(err)). This would have the advantage of making the Registerer interface leaner.
Another consideration is that users of the global registry have gravitated towards promauto for a while now. So perhaps it's better to have the global registry in promauto, perhaps with a Register top-level function there for use with custom collectors.
This would pave the road for a registry package, which was discussed before, so that registry concerns would be all in that package, making the prometheus package much cleaner
The text was updated successfully, but these errors were encountered:
beorn7
changed the title
Consider eliminate MustRegister, move global registry to promauto.
Consider eliminating MustRegister, moving global registry to promauto.
Feb 13, 2020
Hm, I like the promauto in a way that making this part auto-registered and panicking and removing panicking part from prometheus seems like a clean and reasonable separation. 👍
I mostly assigned this to myself as a “default” because I used to be the maintainer of this repo. Therefore, I'm un-assigning this from myself no. New maintainers @bwplotka & @kakkoyun, please deal with this as you see fit.
With the additions to the promauto package in #713 , the need for
MustRegister
is diminished: Whoever doesn't care about panicking, can and should usepromauto
constructors, no matter if they want the local or the global registry. Whoever wants to play safe, won't useMustRegister
anyway. With the notable exception of custom collectors. One might argue that those are rare enough to get registered with the normalRegister
call and subsequent error handling (even if it is just apanic(err)
). This would have the advantage of making theRegisterer
interface leaner.Another consideration is that users of the global registry have gravitated towards
promauto
for a while now. So perhaps it's better to have the global registry inpromauto
, perhaps with aRegister
top-level function there for use with custom collectors.This would pave the road for a
registry
package, which was discussed before, so that registry concerns would be all in that package, making the prometheus package much cleanerThe text was updated successfully, but these errors were encountered: