普罗米修斯按标签百分比

use*_*015 3 prometheus micrometer

我正在尝试从指标下获取失败的百分比

function_counter_total{name="getCar", status="fail"}
function_counter_total{name="getCar", status="emit"}
Run Code Online (Sandbox Code Playgroud)

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

bri*_*zil 5

不建议使用这种方法导出度量标准,因为a)在PromQL中使用它更加困难,并且b)标签应该是整个空间的分区(假定emit是失败的超集,如果不是,则为您要的计算)执行可能不是您想要的)。分开function_totalfunction_failed_total柜台会更好。

如果您必须使用这种形式的指标,则可以

     function_counter_total{status="fail"} 
   / ignoring(status)
     function_counter_total{status="emit"}
Run Code Online (Sandbox Code Playgroud)