[英]Prometheus: Label matching on substraction
I have the following Prometheus query and want the right side of my substraction to only subtract the container_memory_usage_bytes
for each node on the left side of the substraction.我有以下 Prometheus 查询,并希望我的减法右侧只减去减法左侧每个节点的
container_memory_usage_bytes
。
Query:询问:
sum(kube_node_status_capacity_memory_bytes) by (node) - on (instance) group_left container_memory_usage_bytes
The left side of the subtraction works.减法的左侧有效。
But for the whole query I get但对于整个查询,我得到
Error executing query: found duplicate series for the match group;many-to-many matching not allowed: matching labels must be unique on one side
执行查询时出错:找到匹配组的重复系列;不允许多对多匹配:匹配标签在一侧必须是唯一的
How can I make my query to match exactly the labels node == instance from left to right side?如何使我的查询从左到右与标签节点 == 实例完全匹配?
The RHS has no instance label, so it's trying to match all those series to one on the LHS . RHS没有实例标签,因此它试图将所有这些系列与LHS上的一个相匹配。 You have to also add sum before listing
container_memory_usage_bytes
metric, - sum(container_memory_usage_bytes)
.您还必须在列出
container_memory_usage_bytes
指标之前添加sum , - sum(container_memory_usage_bytes)
。
Please take a look here: prometheus-metrics .请看这里: prometheus-metrics 。
Useful article: label-proportions .有用的文章: 标签比例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.