Skip to content
This repository was archived by the owner on Aug 4, 2026. It is now read-only.

Pruning doesn't work when multiple groupings #1

Description

@pbadenski

Based on my understanding of https://github.com/Haufe-Lexware/pushgateway-pruner/blob/master/index.js#L145 metrics are pruned based on a "randomly selected" (ie. first found that is not "job") label. This doesn't work when metrics were reported for multiple groupings. Prometheus pushgateway requires exact match on groupings when deleting the metric, ie.

${PUSHGATEWAY_URL}metrics/job/${job}/${labelName1}/${labelValue1}/${labelName2}/${labelValue2}/.../${labelNameN}/${labelValueN}

As a sidenote.. I am actually not entirely sure if this bug is possible to be fixed easily... I went through pushgateway's documentation and source code, and it seems to me that is not possible over HTTP API extract the list of metrics with their respective groupings. Important: identifying labels is not enough, as not all labels have to be part of the grouping (grouping is some subset of the label set). I believe that it is GetMetricFamiliesMap method in pushgateway which has that information. Grep through the codebase reveals that it doesn't seem to be exposed in any different way than through the UI (https://github.com/prometheus/pushgateway/blob/master/handler/status.go#L85)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions