From 08ceaa48b9fc89ac036b548c3aafa14da60493e1 Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Thu, 28 Nov 2024 15:46:55 +0100 Subject: [PATCH 1/3] (chore): Document keyword. --- docs/sources/query/metric_queries.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/sources/query/metric_queries.md b/docs/sources/query/metric_queries.md index d3d2efb2714d7..2c90e87ebfe8c 100644 --- a/docs/sources/query/metric_queries.md +++ b/docs/sources/query/metric_queries.md @@ -153,3 +153,14 @@ Examples: or vector(0) # will return 0 ``` + +## Probabilistic aggregation + +LogQL also supports a probabilistic `topk` approximation that is a drop-in replacement when `topk` hits the maximum series limit. + +```logql +approx_topk(k, ) +``` + +It is only supported for instant queries and does not support grouping. It is useful when the cardinality of the inner +vector is too high, e.g. when it uses an aggregation by a structured metadata label. From e5062c3df6d085229d2f85927187ddebc8b65d94 Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Tue, 10 Dec 2024 12:02:13 +0100 Subject: [PATCH 2/3] Update docs/sources/query/metric_queries.md Co-authored-by: J Stickler --- docs/sources/query/metric_queries.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/query/metric_queries.md b/docs/sources/query/metric_queries.md index 2c90e87ebfe8c..c1e7caa94529b 100644 --- a/docs/sources/query/metric_queries.md +++ b/docs/sources/query/metric_queries.md @@ -156,7 +156,7 @@ Examples: ## Probabilistic aggregation -LogQL also supports a probabilistic `topk` approximation that is a drop-in replacement when `topk` hits the maximum series limit. +The `topk` keyword lets you find the largest 1,000 elements in a data stream by sample size. When `topk` hits the maximum series limit, LogQL also supports using a probable approximation; `approx_topk` is a drop-in replacement when `topk` hits the maximum series limit. ```logql approx_topk(k, ) From 58dc4e49f9278f92d5de688c26dd204ba5ef2c28 Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Tue, 10 Dec 2024 12:02:19 +0100 Subject: [PATCH 3/3] Update docs/sources/query/metric_queries.md Co-authored-by: J Stickler --- docs/sources/query/metric_queries.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/query/metric_queries.md b/docs/sources/query/metric_queries.md index c1e7caa94529b..153986c2768e4 100644 --- a/docs/sources/query/metric_queries.md +++ b/docs/sources/query/metric_queries.md @@ -163,4 +163,4 @@ approx_topk(k, ) ``` It is only supported for instant queries and does not support grouping. It is useful when the cardinality of the inner -vector is too high, e.g. when it uses an aggregation by a structured metadata label. +vector is too high, for example, when it uses an aggregation by a structured metadata label.