question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prometheus flask exporter in Gunicorn

See original GitHub issue

Is 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:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
arvindkumarccommented, Apr 12, 2021

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.

0reactions
arvindkumarccommented, Apr 12, 2021

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/gunicorn

The same works fine if it is just PrometheusMetrics. Are there any debug modes to be enabled to see what’s happening?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collecting prometheus metrics from a separate port using ...
I would like to collect metrics from this application with prometheus, but the metrics should only be accessible cluster internally on a ...
Read more >
Monitoring Gunicorn with Prometheus
In order for Prometheus to be able to process Gunicorn statsd telemetry, you need to leverage the Prometheus statsd-exporter, which formats ...
Read more >
Monitoring Python Flask microservices with Prometheus
... Python Flask applications with Prometheus using an exporter library! ... for popular multiprocessing libraries, like uWSGI and Gunicorn.
Read more >
Pandora's Flask: Monitoring a Python web app with ...
In a naive deployment of the Prometheus Python client for a Flask app running under uWSGI, each request from the Prometheus server to...
Read more >
Flask prometheus gunicorn docker real app - GitHub Pages
flask -prometheus-gunicorn-docker-real-app · Flask prometheus gunicorn docker real app · Docker build · Docker run · Request metrics test · Sample Response.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found