absent()

The absent() function takes an instant vector as an argument and returns the following:

  • An empty vector if the argument has results
  • 1-element vector with the sample value equal to 1, containing the labels from the specified argument in the case of non-conflicting equality matchers

This function is quite useful for alerting on, as the name suggests, absent time series.

For example, say that the instant vector exists and we execute the following expression:

absent(http_requests_total{method="get"})

This will return the following:

no data

Let's say we use an expression with a label matcher using a nonexistent label value, like in the following example:

absent(http_requests_total{method="nonexistent_dummy_label"})

This will produce an instant vector with the nonexistent label value:

{method="nonexistent_dummy_label"} 1

Let's apply absent to a nonexistent metric, as shown in this snippet:

absent(nonexistent_dummy_name)

This will translate into the following output:

{} 1

Finally, let's say we use absent on a nonexistent metric and a nonexistent label/value pair, as shown in the following snippet:

absent(nonexistent_dummy_name{method="nonexistent_dummy_label"})

The result can be seen in the following snippet:

{method="nonexistent_dummy_label"} 1
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.31.159