Prometheus flask exporter in Gunicorn
See original GitHub issueIs this needed to be implemented in gunicorn config file? `` def when_ready(server): GunicornPrometheusMetrics.start_http_server_when_ready(8080)
``
I am getting duplication port error.
My config file looks like ` from consul_integration import register_service,deregister_service,instanceID from prometheus_flask_exporter.multiprocess import GunicornPrometheusMetrics
hostname = “0.0.0.0” portname = 8080
def when_ready(server): GunicornPrometheusMetrics.start_http_server_when_ready()
# Called just before the master process is initialized. def on_starting(server): register_service()
def child_exit(server, worker): GunicornPrometheusMetrics.mark_process_dead_on_child_exit(worker.pid)
# Called just before exiting Gunicorn. def on_exit(server): deregister_service(instanceID) `
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Solved it. The issue was the
prometheus_multiproc_dir
variable should be outside from.env
Earlier the same was set from
os.environ['prometheus_multiproc_dir']
which wasn’t visible to the downstream processes.I’ve followed the doc above, but there is only a blank response on
/metrics
endpoint. as in here: https://github.com/rycus86/prometheus_flask_exporter/tree/master/examples/gunicornThe same works fine if it is just PrometheusMetrics. Are there any debug modes to be enabled to see what’s happening?