File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -403,7 +403,7 @@ implement a proper `describe`, or if that's not practical have `describe`
403
403
return an empty list.
404
404
405
405
406
- ## Multiprocess Mode (Gunicorn)
406
+ ## Multiprocess Mode
407
407
408
408
Prometheus client libaries presume a threaded model, where metrics are shared
409
409
across workers. This doesn't work so well for languages such as Python where
@@ -417,6 +417,28 @@ This comes with a number of limitations:
417
417
- The pushgateway cannot be used
418
418
- Gauges cannot use the ` pid ` label
419
419
420
+ Create a multiprocess registry and expose it via ` start_http_server ` .
421
+
422
+ ``` python
423
+
424
+ from prometheus_client import multiprocess, CollectorRegistry
425
+
426
+ mpr = CollectorRegistry()
427
+ multiprocess.MultiProcessCollector(mpr)
428
+
429
+ ...
430
+
431
+ # Serve multiprocess metrics
432
+ start_http_server(8001 , registry = mpr)
433
+
434
+ # Serve default registry.
435
+ start_http_server(8000 )
436
+
437
+ ```
438
+
439
+
440
+ ## Multiprocess Mode (Gunicorn)
441
+
420
442
There's several steps to getting this working:
421
443
422
444
** One** : Gunicorn deployment
You can’t perform that action at this time.
0 commit comments