MetricFamilyToOpenMetrics produces output that cannot be parsed
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu trong package expfmt với MetricFamilyToOpenMetrics, FinalizeOpenMetrics và parser.TextToMetricFamilies, sử dụng reproducer trong issue làm test đầu tiên cần chạy. Theo dõi cách suffix _total được xử lý trong quá trình tuần tự hóa và phân tích cú pháp. Được xem là hoàn tất khi round trip OpenMetrics được báo cáo không còn tạo ra lỗi HELP xung đột và cách xử lý các tên ngắn trùng lặp đã được làm rõ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I am debugging https://github.com/prometheus/jmx_exporter/issues/621, and I found I can reproduce the root cause of the error with the following test in github.com/prometheus/common/expfmt:
package expfmt
import (
"bytes"
"strings"
"testing"
)
func TestJvmClassesLoaded(t *testing.T) {
in := `
# HELP jvm_classes_loaded The number of classes that are currently loaded in the JVM
# TYPE jvm_classes_loaded gauge
jvm_classes_loaded 6129.0
# HELP jvm_classes_loaded_total The total number of classes that have been loaded since the JVM has started execution
# TYPE jvm_classes_loaded_total counter
jvm_classes_loaded_total 6143.0
`
metricFamilies, err := parser.TextToMetricFamilies(strings.NewReader(in))
if err != nil {
t.Error(err)
}
openMetricsOutput := bytes.NewBuffer(make([]byte, 0))
for _, metricFamily := range metricFamilies {
if _, err := MetricFamilyToOpenMetrics(openMetricsOutput, metricFamily); err != nil {
t.Fatal(err)
}
}
if _, err := FinalizeOpenMetrics(openMetricsOutput); err != nil {
t.Fatal(err)
}
_, err = parser.TextToMetricFamilies(strings.NewReader(openMetricsOutput.String()))
if err != nil {
t.Error(err)
}
}
It fails with
=== RUN TestJvmClassesLoaded
jvm_classes_loaded_test.go:33: text format parsing error in line 4: second HELP line for metric name "jvm_classes_loaded"
--- FAIL: TestJvmClassesLoaded (0.00s)
FAIL
FAIL github.com/prometheus/common/expfmt 0.002s
FAIL
As the error message indicates, the reason is that the _total suffix is truncated in HELP and TYPE (as defined in #214), and the resulting "short name" conflicts with the name of the gauge.
Two full serialization steps are needed to trigger the error (OpenMetrics format -> Go objects -> OpenMetrics format -> Go objects), so this might seem like an issue that doesn't occur in practice. However, in https://github.com/prometheus/jmx_exporter/issues/621 this happens because of the following setup:
jmx_exporter -> exporter_exporter -> Prometheus server
I'm not sure what to do about this. Should exporters prevent metrics from having the same "short name"?
- 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
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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.
Issue khác của prometheus/common
-
🧭 PR Triage DashboardĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
prometheus/common#1023 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
expfmt: OpenMetrics 1.0 output with a unit that is not a name suffix fails the whole scrape in PrometheusCó thể đã có người làm @itsmeasadali đã nhận 40 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
prometheus/common#1005 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 52/100
prometheus/common#876 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Feature request: Add client_assertion field for oauth2 jwt-bearer grant typeCó thể đã có người làm @alliasgher đã nhận 218 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
prometheus/common#869 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
prometheus/common#858 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của prometheus/common
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
orion-belt-dev/orion-belt#181 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
kubesmarts/logic-operator#105 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
jakartaee/jakartablogs.ee#125 ·
-
story
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
patch-it-dev/patch-it-plugins#120 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Plugin] calendarĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
MUKE-coder/grit#228 ·