Return no value if value of related query is X


I’m using blackbox exporter (pinging) which annoyingly just returns the full timeout value when the target was not reached. This means that when I use a time series graph, simply using the probe_duration metric will give me peaks of <configured timeout value> when the probe failed which, while it certainly helps get my attention, is not actually correct. There is a different metric probe_success (returns 0 or 1) which you’re supposed to use to tell whether it actually succeeded. I would now like to use this in order to indicate “no value” in the graph.

Current query:


So what I need is something like this:

if (probe_success{instance="$instance"} == 1) probe_duration_seconds{instance="$instance"}

I do not want it to simply return 0.