如何解决两个差异指标的除法查询?

时间:2019-09-24 12:05:25

标签: grafana prometheus

我必须在grafana上查询普罗米修斯:

首先延迟:

mtr_latency{quantile=~"$quantile",alias=~"$mtr_endpoint",instance=~"$instance",hop_id=~"$hop_id",hop_ip=~"$hop_ip"}

第二个已发送包裹:

mtr_sent{alias=~"$mtr_endpoint",instance=~"$instance",hop_id=~"$hop_id",hop_ip=~"$hop_ip"}

如何解决将两个指标相除的查询:

(mtr_latency{quantile=~"$quantile",alias=~"$mtr_endpoint",instance=~"$instance",hop_id=~"$hop_id",hop_ip=~"$hop_ip"}/mtr_sent{alias=~"$mtr_endpoint",instance=~"$instance",hop_id=~"$hop_id",hop_ip=~"$hop_ip"})

谢谢!

1 个答案:

答案 0 :(得分:0)

有结果,但是没有显示实际的地铁数据:

(sum(mtr_latency{alias=~"$mtr_endpoint",instance="$instance",hop_id=~"$hop_id",hop_ip=~"$hop_ip"}) by (instance, alias, hop_id, hop_ip))/(sum(mtr_sent{alias=~"$mtr_endpoint",instance="$instance",hop_id=~"$hop_id",hop_ip=~"$hop_ip"}) by (alias,instance,hop_id,hop_ip))