rycus86 / prometheus_flask_exporter

Prometheus exporter for Flask applications
https://pypi.python.org/pypi/prometheus-flask-exporter
MIT License
645 stars 161 forks source link

Gunicorn mutliprocess with app factory pattern examples #154

Open jdyer09 opened 1 year ago

jdyer09 commented 1 year ago

I'm wondering if it's possible to use the app factory pattern with the gunicorn multiprocess version of the exporter? My knowledge around the internals of the factory pattern are admittedly a little lacking and I'm not quite sure how to make this work.

I'm happy to try and put together a code sample for the examples folder if someone can provide me with a step in the right direction.

I'm also starting to think that this just isn't a use case that exists, am I right in thinking that since the multiprocess version spins up it's own flask application that it it doesn't need the factory pattern at all? Also, following this, the readme for the multiprocess gunicorn example references a config.py that isn't there, I assume the config isn't needed in the example, and it's a copy paste error in the README? https://github.com/rycus86/prometheus_flask_exporter/blob/master/examples/gunicorn-multiprocess-109/README.md

rycus86 commented 1 year ago

Hello!

I'm wondering if it's possible to use the app factory pattern with the gunicorn multiprocess version of the exporter?

Yeah, I don't see why not, though admittedly I haven't tried. If you give it a go and run into problems, let me know and we can work it out together.

Also, following this, the readme for the multiprocess gunicorn example references a config.py that isn't there, I assume the config isn't needed in the example, and it's a copy paste error in the README?

Yep, I think you're right, I must have copied the README from another example that actually has & needs a config.py.