8000 Disable GCCollector in multiprocess mode (#324) · michal0A/client_python@48cbd38 · GitHub
[go: up one dir, main page]

Skip to content

Commit 48cbd38

Browse files
akxbrian-brazil
authored andcommitted
Disable GCCollector in multiprocess mode (prometheus#324)
* Add Pytest cache and Coverage HTML report dirs to gitignore * Disable the GC collector in multiprocess mode Works around prometheus#322 Signed-off-by: Aarni Koskela <akx@iki.fi>
1 parent 7674ab3 commit 48cbd38

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ dist
66
.coverage.*
77
.coverage
88
.tox
9+
.*cache
10+
htmlcov

prometheus_client/gc_collector.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
from __future__ import unicode_literals
44

55
import gc
6+
import os
67
import time
78

89
from . import core
910

1011
class GCCollector(object):
1112
"""Collector for Garbage collection statistics."""
1213
def __init__(self, registry=core.REGISTRY, gc=gc):
14+
# To work around the deadlock issue described in
15+
# https://github.com/prometheus/client_python/issues/322,
16+
# the GC collector is always disabled in multiprocess mode.
17+
if 'prometheus_multiproc_dir' in os.environ:
18+
return
19+
1320
if not hasattr(gc, 'callbacks'):
1421
return
1522

0 commit comments

Comments
 (0)
0