Prometheus arithmetic operators: default values for missing matches?

Viewed 55

I want to do a query like: success_count/(success_count + failure_count) but label combinations that are missing in failure_count won't show up in the result.

E.g.: Let's say I have:

success_count{name="a"} = 8
failure_count{name="a"} = 2
success_count{name="b"} = 10

I would like the query result to be:

{name="a"} = 0.8
{name="b"} = 1.0

But it actually is:

{name="a"} = 0.8

Is there a way to chose a default value of 0 for failure_count whenever it's missing? Or some other way to preserve all label combinations from the left-hand side?

0 Answers
Related