would be nice if `Info.info()` accepted non-`str` types in the given `dict`
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 35/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- python
研究方向
先找出 Info.info() 的實作及其現有測試,然後使用包含 float、int 和 bool 值的 dict 重現回報的失敗。當支援的非字串值能以定義明確的表示形式被接受,且測試涵蓋轉換行為時,工作即完成。
由索引模型根據 Issue 內容生成。
描述
Hey.
Right now, when one feeds a dict into Info.info()that contains values that are notstr` one get's an exception, like:
AttributeError: ("'float' object has no attribute 'replace'", Metric(smart_array, blafasl, info, , [Sample(name='smart_array_info', labels={'slot': '0', 'serial_number': 'xxx', 'controller_status': 'OK', 'hardware_revision': 'B', 'firmware_version': '6.60', 'rebuild_priority': 'High', 'cache_status': 'OK', 'battery_capacitor_status': 'OK', 'controller_temperature_celsius': 49.0, 'cache_module_temperature_celsius': 38.0, 'model': 'Smart Array P840ar'}, value=1.0, timestamp=None, exemplar=None)]))
IMO it woud be nice if that would accept at least other base Python types like int, float and bool and convert these automatically do a suitable representation (which is obvious, I guess, expect perhaps for bool , where one could go by 0/1 (guess that should be it) or True/False/etc.).
Stripping off \n and the likes wouldn't be needed for those types anyway.
Perhaps one could make it generic? Only if the value is an instance of str, try to .replace(...) in all other cases, make a str() out of it?
Maybe with an exception for bool if 0/1 shall be used.
Cheers,
Chris.
- 主要語言
- Python
- 星號
- 4.4k
- 分支
- 882
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
prometheus/client_python 的其他 Issue
-
OpenMetrics content negotiation: `escaping=underscores` causes name mismatch between `HELP/TYPE` metadata and sample lines for metrics with colons可能已有人在做 @johnsaurabh 於 128 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 70/100
prometheus/client_python#1177 · 1 則留言 ·
-
Optimize labels() existing-child lookups to avoid parent lock contention可能已有人在做 @skulitom 於 1 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 68/100
prometheus/client_python#1215 · 1 個 reaction ·
-
難度 4/5 3-5 天 新手友好度 45/100
prometheus/client_python#1210 ·
-
MultiProcessCollector fails permanently on an empty metrics file left by a killed worker可能已有人在做 @dom111 於 59 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 58/100
prometheus/client_python#1199 · 1 個 reaction ·
-
難度 5/5 一週以上 新手友好度 35/100
prometheus/client_python#1176 ·
查看 prometheus/client_python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
-
EvaluationSuite.run fails with default args_for_task and mutates supplied kwargs可能已有人在做 @ktz03 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
huggingface/evaluate#825 ·
維護者通常 1 天內回覆
-
dependencies feature github_actions good first issue
難度 2/5 1-3 小時 新手友好度 62/100
wemake-services/wemake-django-template#3149 ·
維護者通常 1 天內回覆
-
upstream update
難度 2/5 1-3 小時 新手友好度 65/100
conan-io/conan-center-index#31142 ·
維護者通常 1 天內回覆
-
area:core bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆