prometheus / prometheus/client_python

Increase the usage of augmented assignment statements

Đang mở
#716 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
4.4k
Fork
876
Merge trung bình
8 ngày 4 giờ
Pull request đã merge (30 ngày)
1

Mô tả

👀 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'

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu trong prometheus_client/exposition.py tại generate_latest và xem xét ba nhánh loại metric được nêu trong issue. Thực hiện các thay đổi có chủ đích đối với phép gán tăng dần và xác nhận rằng đầu ra Prometheus được tạo ra vẫn không thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
observability
Loại issue
Tái cấu trúc
Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.