expfmt: Implement OpenMetrics generation

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

Maintainer thường phản hồi trong vòng 2 ngày

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
go
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu bằng cách đọc package expfmt và metrics.proto, sau đó xem lại các TODOs còn lại trong issue này để xác định những tính năng OpenMetrics và quyết định về khả năng tương thích nào vẫn nằm trong phạm vi. Kiểm tra hỗ trợ tạo OpenMetrics hiện có và các bài kiểm thử của nó, nếu có. Được xem là hoàn thành khi tập hợp tính năng đã thống nhất được triển khai, các đầu vào không được hỗ trợ được xử lý và legacy negotiation vẫn có thể sử dụng.

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

Mô tả

To support OpenMetrics in v1 of prometheus/client_golang, we need to add OpenMetrics generation to the expfmt package, effectively a proto-to-OpenMetrics converter.

For this to work, we need to add the needed additional fields to metrics.proto. This should be backwards compatible for still existing protobuf consumers, while it provides an "inofficial" protobuf representation for OpenMetrics as a byproduct. This has the potential of creating confusion. However, the prometheus/client_model repo is anyway mostly deprecated, so we might as well abuse it for this "hack".

Update: Basic support is done. Here are the remaining TODOs (some of them will require more or less breaking changes, so we might consider bundling them and perhaps even starting to use major version numbers for this repo):

  • Feature support:
    • # UNIT.
    • _created.
    • info type.
    • stateset type.
    • gaugehistogram type.
  • Figure out how to deal with the _total suffix. (Currently, we require it to be in the metric name and truncate it for TYPE/HELP, which is arguably the opposite of what would be expected but which simplifies the transition from current Prom text format usage.)
  • Reject exemplars that are too long.
  • Reject counters with NaN
  • More sophisticated timestamp rendering for both samples and exemplars (to not run into precision and overflow issues with float64 and time.UnixNano).
  • Get rid of NegotiateIncludingOpenMetrics (but we have to make sure there remains some way of letting users opt out of OpenMetrics to support legacy setups – which could be on the Prometheus server side by making the Accept header configurable).
  • Add the Close method directly to the Encoder interface.
Ngôn ngữ chính
Go
Star
297
Fork
380
Merge trung bình
3 ngày 15 giờ
Pull request đã merge (30 ngày)
13

Chuẩn bị môi trường

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.

Issue khác của prometheus/common

Tất cả issue của prometheus/common

Issue tương tự

Thêm issue về Go

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.