Proposal: Rework metric instantiation to get-or-set from the registry
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 30/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- python
研究方向
首先閱讀 prometheus_client.registry.Registry 和 prometheus_client.metrics.MetricWrapperBase,包括 Counter() 如何在全域註冊表中註冊名稱。追蹤重新載入時的名稱衝突,並定義所需的註冊表 get-or-set 行為,以便重新載入時重新取得現有指標,而不會重複註冊。
由索引模型根據 Issue 內容生成。
描述
At present (v0.19.0 and previously) the prometheus_client.registry.Registry class is secondary in terms of API control flow to the prometheus_client.metrics.MetricWrapperBase and subclasses in that a caller says prometheus_client.Counter() and doing so implicitly first instantiates a new metric and then registers the names it defines into the global registry.
This makes the default behavior of the library code-reloading unsafe. Today if you reload code which invokes Counter(), you get a new counter instance which encounters a name conflict when it tries to register itself.
It would be better if the primary interface first performed a get-or-set against the specified registry so that reloading would re-fetch the original counter functionally as a singleton.
The real solution is that we should be explicitly managing and lifecycling registries, but the library default behavior of using a shared global registry creates this pitfall.
- 主要語言
- Python
- 星號
- 4.4k
- 分支
- 876
- 平均合併
- 8 天 4 小時
- 30 天內合併 PR
- 1
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
prometheus/client_python 的其他 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 70/100
prometheus/client_python#1177 · 1 則留言 ·
-
難度 4/5 3-5 天 新手友好度 45/100
prometheus/client_python#1210 ·
-
難度 2/5 1-3 小時 新手友好度 58/100
prometheus/client_python#1199 · 1 個 reaction ·
-
難度 5/5 一週以上 新手友好度 35/100
prometheus/client_python#1176 ·
-
難度 1/5 1-3 小時 新手友好度 52/100
prometheus/client_python#1126 · 2 則留言 ·
查看 prometheus/client_python 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
stephrobert/dsoxlab#238 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 75/100
sublimehq/package_control#1780 ·
-
難度 2/5 1-3 小時 新手友好度 65/100
-
難度 2/5 1-3 小時 新手友好度 70/100
nwg-piotr/nwg-displays#145 ·