mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-08 23:48:12 +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: https://github.com/prometheus/client_python/blob/d7c9cd88c7f50097cd86869974301df7615bc9c0/prometheus_client/multiprocess.py#L166-L167 * format --------- Co-authored-by: Stan Triepels <1939656+GDay@users.noreply.github.com>
This commit is contained in:
co-authored by
Stan Triepels
parent
c1e00b09cb
commit
c3b49cca25
+8
-1
@@ -1,4 +1,5 @@
|
|||||||
# Standard
|
# Standard
|
||||||
|
import os
|
||||||
import signal
|
import signal
|
||||||
import socket
|
import socket
|
||||||
import uuid
|
import uuid
|
||||||
@@ -230,8 +231,14 @@ class Sentinel:
|
|||||||
% {"name": process.name}
|
% {"name": process.name}
|
||||||
)
|
)
|
||||||
else:
|
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)
|
prometheus_multiprocess.mark_process_dead(process.pid)
|
||||||
|
|
||||||
self.pool.remove(process)
|
self.pool.remove(process)
|
||||||
self.spawn_worker()
|
self.spawn_worker()
|
||||||
if process.timer.value == 0:
|
if process.timer.value == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user