Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

would be nice if `Info.info()` accepted non-`str` types in the given `dict`

オープン
#1,046 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
observability

調査の方向性

まず 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
フォーク
876
平均マージ
8日 4時間
マージ済み PR(30日)
1

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

prometheus/client_python のほかの issue

prometheus/client_python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。