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.

uwsgi app stall gathering /metrics

See original GitHub issue

Hello 👋 , I have a timeout on /metrics endpoint. I followed the example of uwsgi file:

cat app/__init__.py
...
app = Flask(__appname__)
metrics = UWsgiPrometheusMetrics(app)
metrics.register_endpoint('/metrics')
...
cat app/api/__init.py
...
app.logger.info('Starting the app...')
metrics.start_http_server(port))
metrics.info('app_info', 'Application info', version=__version__)
...

The app starts correctly. One of my resources is correctly responding, ex:

[pid: 64365|app: 0|req: 4/5] 127.0.0.1 () {24 vars in 257 bytes} [Wed Oct 23 09:47:48 2019] GET /test => generated 4 bytes in 0 msecs (HTTP/1.1 200) 2 headers in 78 bytes (2 switches on core 0)

but the /metrics endpoint is not, the HTTP session timeout with:

curl: (56) Recv failure: Connection reset by peer

Any idea?

uwsgi config:

[uwsgi]
http-socket = :5000
; wsgi-file = wsgi.py
module = wsgi:app
; socket = /var/run/app
; chdir = /usr/local/bin/app
; chown-socket = www-data:www-data
chmod-socket = 660
callable = app
master = true
processes = 2
die-on-term = true
; logto = /var/log/uwsgi/app.log
venv = /tmp/venv
env = prometheus_multiproc_dir=/tmp/flask_microservice_boilerplate/metrics

the prometheus_multiproc_dir dir is correctly filled with:

ls /tmp/flask_microservice_boilerplate/metrics
counter_45330.db  counter_57640.db  gauge_all_45304.db  gauge_all_50896.db  gauge_all_57640.db  gauge_all_64364.db  histogram_50896.db  histogram_64364.db
counter_50895.db  counter_60502.db  gauge_all_45330.db  gauge_all_56034.db  gauge_all_60498.db  gauge_all_64365.db  histogram_57639.db  histogram_64365.db
counter_50896.db  counter_64364.db  gauge_all_50891.db  gauge_all_57636.db  gauge_all_60502.db  histogram_45330.db  histogram_57640.db
counter_57639.db  counter_64365.db  gauge_all_50895.db  gauge_all_57639.db  gauge_all_64361.db  histogram_50895.db  histogram_60502.db

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kaminekcommented, Nov 12, 2019

Hi @rycus86 sorry I was on vacation, I’ll do some debug tests asap

0reactions
rycus86commented, Nov 25, 2019

Closing this for inactivity, feel free to reopen if needed and have more data!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Metrics subsystem — uWSGI 2.0 documentation
The uWSGI metrics subsystem allows you to manage “numbers” from your app. While the caching subsystem got some math capabilities during the 1.9...
Read more >
Configuring uWSGI for Production: The defaults are all wrong
"Configuring uWSGI for Production: The defaults are all wrong[EuroPython 2019 - Talk - 2019-07-12 - Singapore][Basel, CH]By Peter SperlTwo ...
Read more >
How to export app metrics using prometheus client from an ...
Isn't calling mkdtemp() in multiprocess code (across many uWSGI workers) gonna create separate temp dirs which would defeat the purpose of ...
Read more >
uWSGI snmp stats - django - Server Fault
... export only values managed by the apps via the api. The new api is this one: http://uwsgi-docs.readthedocs.org/en/latest/Metrics.html.
Read more >
uwsgi Changelog - pyup.io
Fix application loading without Plack after excluding ". ... The Metrics subsystem allows you to store "numbers" related to monitoring, graphing and quality ......
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