prometheus / prometheus/client_python
OpenMetrics support for textfile collector
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ả
Currently prometheus_client.exposition.write_to_textfile doesn't support the OpenMetrics text format, which I'm addressing with this (private) hack:
from prometheus_client.openmetrics.exposition import (
generate_latest as generate_latest_openmetrics,
)
from prometheus_client.registry import CollectorRegistry
def write_openmetrics_to_textfile(path: str, registry: CollectorRegistry) -> None:
"""
Fork of `prometheus_client.exposition.write_to_textfile`, as the project
didn't provide an OpenMetrics variant of this helper function.
"""
with open(path, "wb") as fp:
fp.write(generate_latest_openmetrics(registry))
Would your project be interested in a non-hacky (as is the case above) OpenMetrics support for textfile collector?
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu tại prometheus_client.exposition.write_to_textfile và so sánh hành vi của nó với prometheus_client.openmetrics.exposition.generate_latest. Xác định cách helper nên cung cấp đầu ra OpenMetrics trong khi vẫn giữ nguyên hành vi hiện có của textfile collector. Hoàn tất khi helper được hỗ trợ ghi văn bản OpenMetrics hợp lệ cho registry được cung cấp và được bao phủ bởi các test liên quan của dự án.
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ính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100