prometheus / prometheus/client_python

Registry types inconsistency

Open
#825 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

Encoder generate_latest (for example) accepts registry of CollectorRegistry type but it doesn't accept registry of RestrictedRegistry type so it is not consistent. I guess RestrictedRegistry class should inherit CollectorRegistry class because instance of it can be passed to encoders (maybe not only encoders).

Another option is to inherit RestrictedRegistry class from Collector class because CollectorRegistry is inherited from this class, but then anything that accepts CollectorRegistry type should be changed to accept Collector type.

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 at the generate_latest encoder entry point and compare its CollectorRegistry handling with RestrictedRegistry. Determine the intended registry type relationship and verify that the chosen design makes RestrictedRegistry acceptable anywhere a CollectorRegistry is expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.