Skip to content

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

Closed

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

Activity

  1. atollena commented on Apr 25, 2017

    @atollena
    ContributorAuthor

    @brian-brazil full_name could simply be passed instead of just name at 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.

  2. brian-brazil commented on Apr 25, 2017

    @brian-brazil
    Contributor

    That sounds like the right fix, and a PR would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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