Skip to content
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

Registering new collectors with GunicornInternalPrometheusMetrics #153

Open
gmelasecca opened this issue Mar 7, 2023 · 1 comment
Open

Comments

@gmelasecca
Copy link

gmelasecca commented Mar 7, 2023

Hello. I am unsure if this is the right place to ask this question but I was wondering about how we can utilize the GunicornInternalPrometheusMetrics class while also being able to register custom metrics defined as a class. Similar to the examples that prometheus_client provide in their docs here: custom-collectors in prometheus-client

the reason I am asking about this is because I need to define a couple of custom collectors for specific use cases and if this is simple enough I wont try to hack around it (my specific use case has no bearing on the question itself). I am already using the register_defults() method but it is not the same as me allowing customers/users to build their Collector() classes and import them into our application without modifying our existing code hence why I am asking to allow a custom collector to be registered to the GunicornInternalPrometheusMetrics app & registry.

thank you for any help. ps. I am loving how simple you have made this library to work with so far.

@rycus86
Copy link
Owner

rycus86 commented Mar 7, 2023

Hi,

Yep, that should work as expected, though let me know if you find otherwise. As mentioned in the https://github.com/rycus86/prometheus_flask_exporter#configuration we use the default REGISTRY when you don't specify it manually, and if you add the custom collectors to a custom registry, then just make sure to pass that to the PrometheusMetrics constructor.

I am loving how simple you have made this library to work with so far.

Thanks, I'm glad you find it easy to use!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants