Skip to content

Commit

Permalink
components/query: add a paragraph about filter
Browse files Browse the repository at this point in the history
Document the why/what from
#6257 in the Querier
documentation.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
  • Loading branch information
GiedriusS committed Aug 11, 2023
1 parent d6a8f0b commit dd5e441
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 10 additions & 0 deletions docs/components/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ thanos query \

This logic can also be controlled via parameter on QueryAPI. More details below.

### Deduplication on non-external labels

In `v0.31.0` we have implemented an [optimization](../proposals-accepted/20221129-avoid-global-sort.md) which broke deduplication on non-external labels. We think that it was just a coincidence that deduplication worked at all on non-external labels in previous versions.

External labels always override any labels a series might have and this makes it so that it is possible to remove replica labels on series returned by a StoreAPI as an optimization. If deduplication happens on internal labels then that might lead to unsorted series from a StoreAPI and that breaks deduplication.

To fix this use-case, in 0.32.0 we've implemented a cuckoo filter on label names that is updated every 10 seconds. Using it we can detect whether deduplication was requested on internal labels. If that is the case then the series set is resorted before being sent off to the querier. It is strongly recommended to set replica labels which are external labels because otherwise the optimization cannot be applied and your queries will be slower by 20-30%.

In the future we have plans to expose this cuckoo filter through the InfoAPI. This will allow better scoping queries to StoreAPIs.

## Experimental PromQL Engine

By default, Thanos querier comes with standard Prometheus PromQL engine. However, when `--query.promql-engine=thanos` is specified, Thanos will use [experimental Thanos PromQL engine](http://github.com/thanos-community/promql-engine) which is a drop-in, efficient implementation of PromQL engine with query planner and optimizers.
Expand Down
11 changes: 8 additions & 3 deletions docs/proposals-accepted/20221129-avoid-global-sort.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
## Avoid Global Sort on Querier Select
---
type: proposal
title: Avoid Global Sort on Querier Select
status: approved
owner: bwplotka,fpetkovski
menu: proposals-accepted
---

* **Owners:**
* @bwplotka, @fpetkovski
## Avoid Global Sort on Querier Select

* **Related Tickets:**
* https://github.com/thanos-io/thanos/issues/5719
Expand Down

0 comments on commit dd5e441

Please sign in to comment.