prometheus / prometheus/client_python

[Question] Is "REGISTRY" meant to be a decorator for "Collectors"?

Open
#548 11 comments 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

Browsing through the code I've found a function called write_to_textfile in the exposition module. This function signature looks like this:

def write_to_textfile(path, registry):
    """Write metrics to the given path.
    pass

If you read the implementation of the function, turns out the expectation is not really a registry but instead anything that implements (something like an interface) the .collect() method.

Is that by design?

If so, would it be welcomed the addition of type hints throughout the code? I would be happy to add them and create a PR.

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 in the exposition module at write_to_textfile and compare its registry parameter with the .collect() behavior described in the issue. Before making changes, determine whether type hints throughout the Python codebase are wanted; done would require an agreed scope and maintainer decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.