-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add WrapCollectorWith
and WrapCollectorWithPrefix
#1766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I found myself in a situation where I had to instantiate multiple instances of a third party library that registered some metrics and never un-registered them. In my app's lifecycle I needed to un-register them and then register them again, but I couldn't achieve that by wrapping the Registerer. I decided to register that library's metrics in a separate Registry and register that Registry, but in order to handle multiple instances of the library, I also needed to wrap it with labels, and while such functionality existed already as part of the Registerer wrapping, it wasn't exposed. This PR just exposes Collector wrapping as a public function. Signed-off-by: Oleg Zaytsev <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the test and example, makes the review process pretty smooth and showcase why we'd ever want something like this :)
LGTM, but if possible I'd like to see an approval from someone else who has been more active than I've been during the last couple of months 😅. Maybe @bwplotka or @kakkoyun ?
Hi, any chance we could get this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm merging it. We will still have time to have subsequent PRs until the next release if we want to change anything. |
I found myself in a situation where I had to instantiate multiple instances of a third party library that registered some metrics and never un-registered them. In my app's lifecycle I needed to un-register them and then register them again, but I couldn't achieve that by wrapping the Registerer. I decided to register that library's metrics in a separate Registry and register that Registry, but in order to handle multiple instances of the library, I also needed to wrap it with labels, and while such functionality existed already as part of the Registerer wrapping, it wasn't exposed. This PR just exposes Collector wrapping as a public function. Signed-off-by: Oleg Zaytsev <[email protected]>
I found myself in a situation where I had to instantiate multiple instances of a third party library that registered some metrics and never un-registered them. In my app's lifecycle I needed to un-register them and then register them again, but I couldn't achieve that by wrapping the Registerer. I decided to register that library's metrics in a separate Registry and register that Registry, but in order to handle multiple instances of the library, I also needed to wrap it with labels, and while such functionality existed already as part of the Registerer wrapping, it wasn't exposed. This PR just exposes Collector wrapping as a public function. Signed-off-by: Oleg Zaytsev <[email protected]>
I found myself in a situation where I had to instantiate multiple instances of a third party library that registered some metrics and never un-registered them.
In my app's lifecycle I needed to un-register them and then register them again, but I couldn't achieve that by wrapping the Registerer.
I decided to register that library's metrics in a separate Registry and register that Registry, but in order to handle multiple instances of the library, I also needed to wrap it with labels, and while such functionality existed already as part of the Registerer wrapping, it wasn't exposed.
This PR just exposes Collector wrapping as a public function.