首页 > 解决方案 > 将多个指标与唯一标签进行比较时,指标不匹配

问题描述

我有 2 个指标,例如:

metric1{lable1="a",label2,...}
metric1{lable1="b",label2,...}
metric2{lable1="a",label2,...}

预期结果:

metric1{label1="b"}

metric2因为不存在匹配的标签。

上述预期结果的 PromQL 是什么?

标签: prometheus

解决方案


metric1 unless metric2?

或者,如果您只想匹配标签子集,metric1 unless on(label1, label2) metric2.


推荐阅读