Skip to content

Commit 60716cc

Browse files
committed
Add a note about required uWSGI/Gunicorn settings
Add a note to the exports documentation that one has to set `lazy-apps = true` (uWSGI) or `preload-app = false` (Gunicorn) in order to actually expose one metrics endpoint per process using the `PROMETHEUS_METRICS_EXPORT_PORT_RANGE` option. See upstream issue #215
1 parent f9e9afc commit 60716cc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

documentation/exports.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ This will make Django-Prometheus try to export /metrics on port
7676
You can then configure Prometheus to collect metrics on as many
7777
targets as you have workers, using each port separately.
7878

79+
This approach requires the application to be loaded into each child process.
80+
uWSGI and Gunicorn typically load the application into the master process before forking the child processes.
81+
Set the [lazy-apps option](https://uwsgi-docs.readthedocs.io/en/latest/Options.html#lazy-apps) to `true` (uWSGI)
82+
or the [preload-app option](https://docs.gunicorn.org/en/stable/settings.html#preload-app) to `false` (Gunicorn)
83+
to change this behaviour.
84+
85+
7986
## Exporting /metrics in a WSGI application with multiple processes globally
8087

8188
In some WSGI applications, workers are short lived (less than a minute), so some

0 commit comments

Comments
 (0)