From c75ebc758c3b1d3dfbb6ef911fba95573a319e26 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 12:26:06 +0100 Subject: [PATCH] [v10.0.x] Docs: adds docs on aggregation functions for alerting (#79741) Docs: adds docs on aggregation functions for alerting (#78893) * Docs: adds docs on aggregation functions for alerting * ran prettier (cherry picked from commit 524debbe534ffb4a95c27994ba11c78001d99db6) Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> --- .../alert-rules/queries-conditions/_index.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/sources/alerting/fundamentals/alert-rules/queries-conditions/_index.md b/docs/sources/alerting/fundamentals/alert-rules/queries-conditions/_index.md index c61c380e4c1..ac98b75cce3 100644 --- a/docs/sources/alerting/fundamentals/alert-rules/queries-conditions/_index.md +++ b/docs/sources/alerting/fundamentals/alert-rules/queries-conditions/_index.md @@ -97,6 +97,27 @@ Checks if any time series data matches the alert condition. Classic condition expression queries always produce one alert instance only, no matter how many time series meet the condition. Classic conditions exist mainly for compatibility reasons and should be avoided if possible. +## Aggregations + +Grafana Alerting provides the following aggregation functions to enable you to further refine your query. + +These functions are available for **Reduce** and **Classic condition** expressions only. + +| Function | Expression | What it does | +| ---------------- | ---------------- | ------------------------------------------------------------------------------- | +| avg | Reduce / Classic | Displays the average of the values | +| min | Reduce / Classic | Displays the lowest value | +| max | Reduce / Classic | Displays the highest value | +| sum | Reduce / Classic | Displays the sum of all values | +| count | Reduce / Classic | Counts the number of values in the result | +| last | Reduce / Classic | Displays the last value | +| median | Reduce / Classic | Displays the median value | +| diff | Classic | Displays the difference between the newest and oldest value | +| diff_abs | Classic | Displays the absolute value of diff | +| percent_diff | Classic | Displays the percentage value of the difference between newest and oldest value | +| percent_diff_abs | Classic | Displays the absolute value of percent_diff | +| count_non_null | Classic | Displays a count of values in the result set that aren't `null` | + ## Alert condition An alert condition is the query or expression that determines whether the alert will fire or not depending on the value it yields. There can be only one condition which will determine the triggering of the alert.