From 4e7a123c776e14771c8f38b9a39370012214de96 Mon Sep 17 00:00:00 2001 From: Cyril Tovena Date: Tue, 8 Dec 2020 02:35:24 -0500 Subject: [PATCH 01/55] Support rate for unwrap expressions. (#3048) This allows to bytes throughput if there were printed in a log line. Examples : ```logql sum by (device) (rate({app="network-dev"} |= "192.16.8.1" | json | unwrap recv_bytes [1m])) ``` Closes #3044 Signed-off-by: Cyril Tovena --- docs/sources/logql/_index.md | 3 ++- pkg/logql/ast.go | 2 +- pkg/logql/engine_test.go | 49 +++++++++++++++++++++++++++++++++++- pkg/logql/functions.go | 13 +++++++--- 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/docs/sources/logql/_index.md b/docs/sources/logql/_index.md index b5e28679db17..d3c69fa91965 100644 --- a/docs/sources/logql/_index.md +++ b/docs/sources/logql/_index.md @@ -423,6 +423,7 @@ We currently support the functions: Supported function for operating over unwrapped ranges are: +- `rate(log-range)`: calculates per second rate of all values in the specified interval. - `sum_over_time(unwrapped-range)`: the sum of all values in the specified interval. - `avg_over_time(unwrapped-range)`: the average value of all points in the specified interval. - `max_over_time(unwrapped-range)`: the maximum value of all points in the specified interval. @@ -431,7 +432,7 @@ Supported function for operating over unwrapped ranges are: - `stddev_over_time(unwrapped-range)`: the population standard deviation of the values in the specified interval. - `quantile_over_time(scalar,unwrapped-range)`: the φ-quantile (0 ≤ φ ≤ 1) of the values in the specified interval. -Except for `sum_over_time`, unwrapped range aggregations support grouping. +Except for `sum_over_time` and `rate` unwrapped range aggregations support grouping. ```logql ([parameter,] ) [without|by (