prometheus / prometheus/client_python

Increase the usage of augmented assignment statements

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

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

主要言語
Python
スター
4.4k
フォーク
876
平均マージ
8日 4時間
マージ済み PR(30日)
1

説明

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of augmented assignment statements accordingly.

diff --git a/prometheus_client/exposition.py b/prometheus_client/exposition.py
index e374144..1c10055 100644
--- a/prometheus_client/exposition.py
+++ b/prometheus_client/exposition.py
@@ -179,9 +179,9 @@ def generate_latest(registry=REGISTRY):
             mtype = metric.type
             # Munging from OpenMetrics into Prometheus format.
             if mtype == 'counter':
-                mname = mname + '_total'
+                mname += '_total'
             elif mtype == 'info':
-                mname = mname + '_info'
+                mname += '_info'
                 mtype = 'gauge'
             elif mtype == 'stateset':
                 mtype = 'gauge'

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

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

はじめの一歩

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

調査の方向性

prometheus_client/exposition.py の generate_latest から始め、issue に示されている 3 つのメトリクスタイプ分岐を確認します。対象となる複合代入の変更を行い、生成される Prometheus 出力が変わらないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
observability
issue の種類
リファクタリング
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

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

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