prometheus / prometheus/client_python

Provide APIs to help application developers test their Histogram-using code

Open
#736 1 comment 1 reaction 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

I have an application that uses Histogram. I want to write some tests that assert that my application is putting values into the right buckets of that histogram.

To read values out of the Histogram it seems that need to either:

  • look at the Histogram's private _buckets attribute, or
  • call Histogram.collectand look at the resulting Metric objects which are documented as "intended only for internal use" and then look at its Samples which aren't documented at all.

Neither of these seems particularly satisfactory. It would be very helpful if client_python provided some way to read bucket counts and the total sum from a Histogram, using documented APIs clearly marked as intended for external use (perhaps only in test suites).

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 inspecting the Python client’s Histogram implementation, especially its _buckets attribute and collect method, along with the Metric and Samples objects it returns. Define and test a documented external API for reading bucket counts and the total sum, with coverage showing that application tests can assert values without using private or internal-only objects.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.