prometheus / prometheus/client_python

Bug in remove function

Open
#955 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.4k
Forks
876
Avg merge
8d 4h
Merged PRs (30d)
1

Description

The remove function failed if the label aren't order in the alphabetical order.
If they aren't, we have a KeyError.

For exemple that failed :
observ_thresholds = Gauge('thresholds', 'Seuil', ['host', 'domaine'])
observ_thresholds.labels('myserveur','prod').set(5)
observ_thresholds.remove('myserveur','prod')

For exemple that is good :
observ_thresholds = Gauge('thresholds', 'Seuil', ['host', 'perimeter'])
observ_thresholds.labels('myserveur','prod').set(5)
observ_thresholds.remove('myserveur','prod')

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the remove function in the Python client and reproduce the failure with the Gauge example using label names in different orders. Verify that removing the labeled value succeeds without a KeyError and that the reported labels are removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.