prometheus / prometheus/client_python

Feature request - public `registry._names_to_collectors` access

未关闭
#1,071 5 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
4.4k
派生
876
平均合并
8 天 4 小时
30 天内合并 PR
1

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中链接的 prometheus_client/registry.py 里的 CollectorRegistry 及其 _names_to_collectors 属性开始。检查 registry 的使用方式,并确定公开访问的兼容性影响。完成的标准是提供一种受支持的公开方式来检查已注册对象,同时不移除现有的内部属性。

由索引模型根据 Issue 内容生成。

评估

技术栈
prometheus, python
领域
observability-sre
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。