flask-prometheus icon indicating copy to clipboard operation
flask-prometheus copied to clipboard

Running app with Gunicorn

Open dmartincc opened this issue 7 years ago • 3 comments

When running a flask app with Gunicorn the metrics monitoring doesn't work, do you plan to setup a multithreading capability for multiple workers?

dmartincc avatar Jan 07 '17 02:01 dmartincc

django-prometheus implemented a strategy where if you have multiple workers, the HTTP server for metric will be attempted to be started on a range of ports. Perhaps that's an idea?

amitsaha avatar Jan 24 '17 05:01 amitsaha

@dmartincc You can set a prometheus_multiproc_dir environment variable, so that prometheus will handle multiprocess by itself. It is undocumented feature. Note that you must create that directory yourself before any of the metrics will be collected.

See https://github.com/prometheus/client_python/blob/master/prometheus_client/core.py#L461

sashgorokhov avatar Sep 14 '17 16:09 sashgorokhov

您好,您的邮件已收到,谢谢!

bagguo avatar Dec 31 '23 11:12 bagguo