You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
namespace/subsystem are not taken into consideration in multiproc mode #158
The namespace and subsystem kwargs add prefixes to metric name when running normally. However, when using the multiprocess mode of the library, those prefixes are ignored.
Here is a small program to reproduce this problem:
from prometheus_client import Counter, CollectorRegistry, start_http_server, generate_latest, multiprocess
import time
registry = CollectorRegistry()
c = Counter('test', 'Test', namespace='foo', subsystem='bar', registry=registry)
c.inc()
multiprocess.MultiProcessCollector(registry)
print(generate_latest(registry).decode())
Running this program prints:
# HELP foo_bar_test Test
# TYPE foo_bar_test counter
foo_bar_test 1.0
# HELP test Multiprocess metric
# TYPE test counter
test 1.0
Activity
atollena commentedon Apr 25, 2017
@brian-brazil
full_namecould simply be passed instead of justnameat https://github.com/prometheus/client_python/blob/master/prometheus_client/core.py#L537 and https://github.com/prometheus/client_python/blob/master/prometheus_client/core.py#L539, but it's not obvious to me that it is the right fix.I'll be happy to make this change or another if you think that it is reasonable.
brian-brazil commentedon Apr 25, 2017
That sounds like the right fix, and a PR would be great.
Fix namespace and subsystem in multiprocess mode (#159)