prometheus / prometheus/client_python
Feature request - public `registry._names_to_collectors` access
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 876
- Avg merge
- 8d 4h
- Merged PRs (30d)
- 1
Description
Now we are working on Prometheus support in FastStream and faced with a problem. Shared registry between different middlewares leads to MetricsContainer duplication. So, we would like to have a public API to chech registry for already registered objects.
Can you please provide public access to this property some way?
https://github.com/prometheus/client_python/blob/master/prometheus_client/registry.py#L31
I think, the easiest way to save old API and provide us with a new one - add a public property like in the following snipper
class CollectorRegistry(Collector):
def __init__(self):
self._names_to_collectors: Dict[str, Collector] = {}
@property
def names_to_collectors(self):
return self._names_to_collectors
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in prometheus_client/registry.py at CollectorRegistry and its _names_to_collectors property, as linked in the issue. Review how the registry is used and identify the compatibility implications of public access. Done means providing a supported public way to inspect registered objects without removing the existing internal attribute.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- prometheus, python
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100