mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
Only trigger prometheus if configured (#231)
* fix prometheus integration
* fix prometheus integration
* Add also lowercase option
As they seem to support that too: d7c9cd88c7/prometheus_client/multiprocess.py (L166-L167)
* format
---------
Co-authored-by: Stan Triepels <1939656+GDay@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# Standard
|
||||
import os
|
||||
import signal
|
||||
import socket
|
||||
import uuid
|
||||
@@ -230,8 +231,14 @@ class Sentinel:
|
||||
% {"name": process.name}
|
||||
)
|
||||
else:
|
||||
if prometheus_multiprocess:
|
||||
# check if prometheus is proper configurated
|
||||
prometheus_path = os.getenv(
|
||||
"PROMETHEUS_MULTIPROC_DIR", os.getenv("prometheus_multiproc_dir")
|
||||
)
|
||||
|
||||
if prometheus_multiprocess and prometheus_path:
|
||||
prometheus_multiprocess.mark_process_dead(process.pid)
|
||||
|
||||
self.pool.remove(process)
|
||||
self.spawn_worker()
|
||||
if process.timer.value == 0:
|
||||
|
||||
Reference in New Issue
Block a user