best practice for multiprocess_mode in python

12 views
Skip to first unread message

Siddharth Ashri

unread,
Jun 24, 2025, 11:19:27 AMJun 24
to Prometheus Users
Hey folks. 
I am setting up multi-process mode for my application and wanted to if it is necessary to call mark_process_dead if my project does not use gauges. Based on the prometheus source code it looks like mark_process_dead only removes the files related to the live gauge metric.
```
def mark_process_dead(pid, path=None):
    """Do bookkeeping for when one process dies in a multi-process setup."""
    if path is None:
        path = os.environ.get('PROMETHEUS_MULTIPROC_DIR', os.environ.get('prometheus_multiproc_dir'))
    for mode in _LIVE_GAUGE_MULTIPROCESS_MODES:
        for f in glob.glob(os.path.join(path, f'gauge_{mode}_{pid}.db')):
            os.remove(f)
``` 
Reply all
Reply to author
Forward
0 new messages