OpenMetrics parser cannot parse the output of `promtool tsdb dump-openmetrics`
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 38/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- python
研究方向
從連結的 build_metric 檢查處開始查看 prometheus_client/openmetrics/parser.py,並將其假設與 promtool tsdb dump-openmetrics 的分組輸出進行比較。使用範例 parser 程式碼和該輸出重現失敗。完成的標準是:定義 parser 對重複指標名稱的行為,並解決已回報的名稱衝突失敗問題。
由索引模型根據 Issue 內容生成。
描述
I tried using the example code...
import sys
from prometheus_client.openmetrics.parser import text_string_to_metric_families
for family in text_string_to_metric_families(sys.stdin.read()):
for sample in family.samples:
print("Name: {0} Labels: {1} Value: {2} Timestamp: {3}".format(*sample))
...to parse an OpenMetrics file produced by promtool tsdb dump-openmetrics, but I run into the following issue:
Traceback (most recent call last):
File "/home/nicolas/IE6/synapse-meshsim/exp/./normalise_timestamps.py", line 6, in <module>
for family in text_string_to_metric_families(sys.stdin.read()):
File "/home/nicolas/IE6/synapse-meshsim/exp/venv/lib/python3.11/site-packages/prometheus_client/openmetrics/parser.py", line 18, in text_string_to_metric_families
yield from text_fd_to_metric_families(StringIO.StringIO(text))
File "/home/nicolas/IE6/synapse-meshsim/exp/venv/lib/python3.11/site-packages/prometheus_client/openmetrics/parser.py", line 543, in text_fd_to_metric_families
yield build_metric(name, documentation, typ, unit, samples)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nicolas/IE6/synapse-meshsim/exp/venv/lib/python3.11/site-packages/prometheus_client/openmetrics/parser.py", line 472, in build_metric
raise ValueError("Clashing name: " + name + suffix)
ValueError: Clashing name: go_gc_duration_seconds
This comes from this code: https://github.com/prometheus/client_python/blob/46eae7bae88f76951f7246d9f359f2dd5eeff110/prometheus_client/openmetrics/parser.py#L487-L489
But I don't understand why this check exists in the first place? In my case, I have the same metrics for multiple instances, and dump-openmetrics groups them by instance, then by metrics name. Can't we just remove this check altogether?
- 主要語言
- 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 confirmed issue
難度 2/5 1-3 小時 新手友好度 75/100
open-webui/open-webui#30750 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
enhancement
難度 2/5 1-3 小時 新手友好度 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
-
good first issue
難度 1/5 1 小時以內 新手友好度 90/100