prometheus百分比标签

问题描述 投票:2回答:1

我试图从公制中获得失败的百分比

function_counter_total{name="getCar", status="fail"}
function_counter_total{name="getCar", status="emit"}

使用prometheus查询function_counter_total{status="fail"} / function_counter_total{status="emit"}购买返回'没有找到数据点'。

prometheus micrometer
1个回答
4
投票

这不是推荐的导出度量的方法,因为a)在PromQL中使用起来比较困难,而b)标签应该是空间上的分区(假设emit是失败的超集,如果不是,那么你要求的计算执行可能不是你想要的)。单独的function_totalfunction_failed_total计数器会更好。

如果您必须使用此表单中的指标,则可以执行此操作

     function_counter_total{status="fail"} 
   / ignoring(status)
     function_counter_total{status="emit"}
© www.soinside.com 2019 - 2024. All rights reserved.