Remove gauge metric
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
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- aws, kubernetes, prometheus, python
- Lĩnh vực
- cloud, infrastructure, observability
Hướng nghiên cứu
Payload nêu khai báo Gauge và lệnh gọi MetricWrapperBase.remove trong traceback, nhưng không có tệp nào trong repository hay bài kiểm thử nào. Hãy bắt đầu bằng cách kiểm tra các API của Gauge và MetricWrapperBase để xóa label, đồng thời xem xét vòng lặp exporter được nêu. Hoàn tất khi xác định được cách được hỗ trợ để xóa metric của node đã bị xóa hoặc xác nhận rằng cần thay đổi thư viện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi all,
I have written a custom exporter for calculating the cost of using a node in AWS.
Here is how it works:
Lets assume I have 3 nodes, each costs 5$/ 1h, when I plot using grafana the sum(cost_metric{}) i get 15$ (3x5$). Lets say after 2 hours one of the nodes get deleted (autoscaling). In that case the total cost should drop to 10$.
The problem is that in my case the metric is preserved and even though the node has been deleted the cost is kept and thus it displays 15$ instead of dropping to 10$
How would I go about saving that problem?
cost_metric = Gauge(
"cost_metric ",
"Cost of running an instance for 1 hour",
["node_name", "instance_type"],
)
...
node_names = get_nodes()
for node_name in node_names:
node_info = get_node_info(node_name)
if node_info is None:
continue
logging.info(f"Updating metrics for node: {node_name}")
# labels section
labels = node_info["metadata"]["labels"]
instance_type = labels.get("beta.kubernetes.io/instance-type", "unknown")
cost = get_cost_of_instance(instance_type)
if cost is not None:
cost_metric.labels(node_name=node_name, instance_type=instance_type).set(cost)
I tried
I collected previous and current nodes in form of dict and then wanted to removed the ones that arent existing, the issue is that :
cost_metric.remove(node_name=node_name, instance_type=instance_type)
Traceback (most recent call last):
File "/home/XXXX/projects/main.py", line 154, in <module>
previous_nodes = update_metrics(previous_nodes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eksohio/projects/main.py", line 131, in update_metrics
cost.remove(node_name=node_name, instance_type=instance_type)
TypeError: MetricWrapperBase.remove() got an unexpected keyword argument 'node_name'
- 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ó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
prometheus/client_python#1210 ·
-
Độ 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 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
prometheus/client_python#1176 ·
-
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 ·
Tất cả issue của prometheus/client_python
Issue tương tự
-
essnmx good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
-
[Feature] 奇物选择添加优先级 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
syfoud/Simulated_Scepter#174 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Giskard-AI/giskard-oss#2840 · 1 bình luận ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Đang mởarea: repo bug perceived difficulty: 2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
yeti-platform/yeti#1380 ·