Collecting prometheus metrics from a separate port using flask and gunicorn with multiple workers
What you would want to do here is start up a separate process just to serve the metrics. Put the app
function in https://github.com/prometheus/client_python#multiprocess-mode-gunicorn in an app of its own, and make sure that prometheus_multiproc_dir
is the same for both it and the main application.