Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

push_to_gateway: handling of spaces in group key values #1064

Copy link
Copy link
@jtougas

Description

@jtougas
Issue body actions

Spaces in a group key value, come back as "+":

reproduction:
(assumes docker interface at 172.17.0.1)

  1. Start PGW: docker run -it --rm -p 9091:9091 prom/pushgateway:v1.6.2
  2. Push metrics and read back
    docker run -it -e PIP_ROOT_USER_ACTION=ignore --rm python:3.10 bash -c "
    pip --disable-pip-version-check install -q prometheus-client && \
    python3 << 'EOF'
    from prometheus_client import push_to_gateway
    from prometheus_client.metrics_core import GaugeMetricFamily
    from prometheus_client.registry import Collector, CollectorRegistry   
    m1 = GaugeMetricFamily(name='spaces_in_group_key_values_status', documentation='N/A')   
    class _CustomCollector(Collector):
        def collect(self):
            yield m1   
    registry = CollectorRegistry()
    registry.register(_CustomCollector())   
    push_to_gateway('http://172.17.0.1:9091',job='job_name',grouping_key={'label': 'value with spaces'},registry=registry)
    EOF
    "; curl -s http://172.17.0.1:9091/metrics | grep spaces
    

expected output:

push_failure_time_seconds{instance="",job="job_name",label="value with spaces"} 0
push_time_seconds{instance="",job="job_name",label="value with spaces"} 1.7290223660476923e+09

actual output:

push_failure_time_seconds{instance="",job="job_name",label="value+with+spaces"} 0
push_time_seconds{instance="",job="job_name",label="value+with+spaces"} 1.7290223660476923e+09
Reactions are currently unavailable

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.