feature request/RFC: leave out a label (from at least `*MetricFamily` samples) when it's value is set to `None`
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
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python
- Lĩnh vực
- observability-sre
Hướng nghiên cứu
Bắt đầu bằng cách xác định các phần triển khai của các lớp *MetricFamily, add_metric và đường dẫn tuần tự hóa đầu ra, sau đó kiểm tra cách các giá trị label None hiện được xác thực. Xác định và kiểm thử hành vi chỉ bỏ qua label bị ảnh hưởng trong khi vẫn giữ lại dữ liệu sample còn lại, sau khi xác nhận rằng các maintainer của dự án đồng ý với RFC này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hey.
This is somewhat related to https://github.com/prometheus/docs/issues/2977, i.e. “what to do if some values of a sample aren’t available”, which obviously may not just be the actual metric value but also values of labels.
AFAIU, labels values are always strings, so sometimes it may be possible to use a special label value to indicate an error, for example if the label would be a host, one might simply use some characters that cannot appear in hostnames or addresses and thus either an empty string or perhaps <unknown> or similar values depending on the error.
But sometimes this may not be possible, in particular when the possible label values are arbitrary (like I have a case where the label is a description which may contain any string including the empty one).
Now in the error case (at least in my use case) it's better to have the rest of the data, but it still feels wrong to use a value for it that would be valid, even though I couldn't determine it on that particular scrape.
The time series is likely anyway already interrupted, so what's IMO the cleanest solution is simply leaving out the respective label in the error case, even if I have another metric which somehow indicates that sometime is fishy (like _up or so).
(Or any better ideas?)
Now I guess often, exporters will simply have a set of *MetricFamily-objects and .add_metrics to it, which requires however all the values for the defined labels to be given.
My proposal/RFC here is: Would it make sense to special-handle a value of None (which currently seems to simply lead to an error), causing it to leave that particular label out from the printed data for the particular label only?
I guess I could look in implementing this, but on a first short glance it didn't seem straightforward, so I wanted to ask what people even think about it.
Cheers,
Chris.
- 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
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/client_python
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
prometheus/client_python#1177 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
prometheus/client_python#1199 · 1 reaction ·
-
WSL and MultiProcessCollector Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 52/100
prometheus/client_python#1126 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
prometheus/client_python#1123 ·
-
prometheus/client_python#1122 · 1 người được giao ·
Tất cả issue của prometheus/client_python
Issue tương tự
-
documentation help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
simonw/sqlite-utils#872 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100