Commit 5560f426 authored by juliusv's avatar juliusv

Merge pull request #10 from brian-brazil/absent

Make documentation for absent() not, uhm, absent
parents 3adfeb0f 6fa47040
...@@ -10,6 +10,24 @@ sort_rank: 3 ...@@ -10,6 +10,24 @@ sort_rank: 3
`abs(v vector)` returns the input vector with all sample values converted to `abs(v vector)` returns the input vector with all sample values converted to
their absolute value. their absolute value.
## `absent(v vector)`
`absent(v vector)` returns an empty vector if the vector passed to it has any
elements and a 1-element vector with the value 1 if the vector passed to it has
no elements.
In the second case, `absent()` tries to be smart about deriving labels of
the 1-element output vector from the input vector:
| Expression | Result
|--------------------------------------------------|--------
| absent(nonexistent{job="myjob"}) | {job="myjob"}
| absent(nonexistent{job="myjob",instance=~".*"}) | {job="myjob"}
| absent(sum(nonexistent{job="myjob"})) | {}
This is useful for alerting on when no time series
exist for a given metric name and label combination.
## `count_scalar()` ## `count_scalar()`
`count_scalar(v instant-vector)` returns the number of elements in a time series `count_scalar(v instant-vector)` returns the number of elements in a time series
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment