Skip to content

namespace/subsystem are not taken into consideration in multiproc mode  #158

@atollena

Description

@atollena

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions