File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,8 @@ def ExportToDjangoView(request):
115115
116116 You can use django_prometheus.urls to map /metrics to this view.
117117 """
118- if "prometheus_multiproc_dir" in os .environ :
118+ if ("PROMETHEUS_MULTIPROC_DIR" in os .environ
119+ or "prometheus_multiproc_dir" in os .environ ):
119120 registry = prometheus_client .CollectorRegistry ()
120121 multiprocess .MultiProcessCollector (registry )
121122 else :
Original file line number Diff line number Diff line change @@ -78,22 +78,22 @@ targets as you have workers, using each port separately.
7878
7979This approach requires the application to be loaded into each child process.
8080uWSGI 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)
81+ Set the [ lazy-apps option] ( https://uwsgi-docs.readthedocs.io/en/latest/Options.html#lazy-apps ) to ` true ` (uWSGI)
8282or the [ preload-app option] ( https://docs.gunicorn.org/en/stable/settings.html#preload-app ) to ` false ` (Gunicorn)
83- to change this behaviour.
83+ to change this behaviour.
8484
8585
8686## Exporting /metrics in a WSGI application with multiple processes globally
8787
8888In some WSGI applications, workers are short lived (less than a minute), so some
8989are never scraped by prometheus by default. Prometheus client already provides
90- a nice system to aggregate them using the env variable: ` prometheus_multiproc_dir `
90+ a nice system to aggregate them using the env variable: ` PROMETHEUS_MULTIPROC_DIR `
9191which will configure the directory where metrics will be stored as files per process.
9292
9393Configuration in uwsgi would look like:
9494
9595``` ini
96- env = prometheus_multiproc_dir =/path/to/django_metrics
96+ env = PROMETHEUS_MULTIPROC_DIR =/path/to/django_metrics
9797```
9898
9999You can also set this environment variable elsewhere such as in a kubernetes manifest.
You can’t perform that action at this time.
0 commit comments