Commit 9b602d3c authored by Brian Brazil's avatar Brian Brazil

Document count_values aggregator.

parent 15e27dba
...@@ -185,6 +185,7 @@ vector of fewer elements with aggregated values: ...@@ -185,6 +185,7 @@ vector of fewer elements with aggregated values:
* `stddev` (calculate population standard deviation over dimensions) * `stddev` (calculate population standard deviation over dimensions)
* `stdvar` (calculate population standard variance over dimensions) * `stdvar` (calculate population standard variance over dimensions)
* `count` (count number of elements in the vector) * `count` (count number of elements in the vector)
* `count_values` (count number of elements with the same value)
* `bottomk` (smallest k elements by sample value) * `bottomk` (smallest k elements by sample value)
* `topk` (largest k elements by sample value) * `topk` (largest k elements by sample value)
...@@ -193,12 +194,18 @@ or preserve distinct dimensions by including a `without` or `by` clause. ...@@ -193,12 +194,18 @@ or preserve distinct dimensions by including a `without` or `by` clause.
<aggr-op>([parameter,] <vector expression>) [without|by (<label list>)] [keep_common] <aggr-op>([parameter,] <vector expression>) [without|by (<label list>)] [keep_common]
`parameter` is only required for `topk` and `bottomk`. `without` removes the `parameter` is only required for `count_values`,`topk` and `bottomk`. `without`
listed labels from the result vector, while all other labels are preserved the removes the listed labels from the result vector, while all other labels are
output. `by` does the opposite and drops labels that are not listed in the `by` preserved the output. `by` does the opposite and drops labels that are not
clause, even if their label values are identical between all elements of the listed in the `by` clause, even if their label values are identical between all
vector. The `keep_common` clause allows keeping those extra labels (labels that elements of the vector. The `keep_common` clause allows keeping those extra
are identical between elements, but not in the `by` clause). labels (labels that are identical between elements, but not in the `by`
clause).
`count_values` outputs one time series per unique sample value. Each series has
an additional label. The name of that label is given by the aggregation
parameter, and the label value is the unique sample value. The value of each
time series is the number of times that sample value was present.
`topk` and `bottomk` are different from other aggregators in that a subset of `topk` and `bottomk` are different from other aggregators in that a subset of
the input samples, including the original labels, are returned in the result the input samples, including the original labels, are returned in the result
...@@ -217,6 +224,10 @@ applications, we could simply write: ...@@ -217,6 +224,10 @@ applications, we could simply write:
sum(http_requests_total) sum(http_requests_total)
To count the number of binaries running each build version we could write:
count_values("version", build_version)
To get the 5 largest HTTP requests counts across all instances we could write: To get the 5 largest HTTP requests counts across all instances we could write:
topk(5, http_requests_total) topk(5, http_requests_total)
......
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