我试图从公制中获得失败的百分比
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"}
购买返回'没有找到数据点'。
这不是推荐的导出度量的方法,因为a)在PromQL中使用起来比较困难,而b)标签应该是空间上的分区(假设emit是失败的超集,如果不是,那么你要求的计算执行可能不是你想要的)。单独的function_total
和function_failed_total
计数器会更好。
如果您必须使用此表单中的指标,则可以执行此操作
function_counter_total{status="fail"}
/ ignoring(status)
function_counter_total{status="emit"}