From f85505bc382cc47d4cb09a145a6d6fbf9c4250f2 Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Tue, 26 Apr 2022 17:17:35 +0200 Subject: [PATCH] Move info about queries that skip cache logic to docs --- docs/components/query-frontend.md | 6 ++++++ pkg/queryfrontend/roundtrip.go | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/components/query-frontend.md b/docs/components/query-frontend.md index 5f6d997cf5b..96cd2886a25 100644 --- a/docs/components/query-frontend.md +++ b/docs/components/query-frontend.md @@ -36,6 +36,12 @@ Query Frontend supports a retry mechanism to retry query when HTTP requests are Query Frontend supports caching query results and reuses them on subsequent queries. If the cached results are incomplete, Query Frontend calculates the required subqueries and executes them in parallel on downstream queriers. Query Frontend can optionally align queries with their step parameter to improve the cacheability of the query results. Currently, in-memory cache (fifo cache) and memcached are supported. +### Excluded from caching + +* Requests that support deduplication and having it disabled with `dedup=false`. Read more about deduplication in [Dedup documentation](./query.md#deduplication-enabled). +* Requests that specify store matchers. +* Requests were the caching is explicitely disabled. + #### In-memory ```yaml mdox-exec="go run scripts/cfggen/main.go --name=queryfrontend.InMemoryResponseCacheConfig" diff --git a/pkg/queryfrontend/roundtrip.go b/pkg/queryfrontend/roundtrip.go index 9fbfd657ed1..74c01cfc85d 100644 --- a/pkg/queryfrontend/roundtrip.go +++ b/pkg/queryfrontend/roundtrip.go @@ -275,10 +275,8 @@ func newLabelsTripperware( } // shouldCache controls what kind of Thanos request should be cached. -// Don't cache: -// * if StoreMatchers are set (since it is debug option). -// * if Dedup is disabled (this is done only for debugging). -// * Caching option disables cache. +// For more information about requests that skip caching logic, please visit +// the query-frontend documentation. func shouldCache(r queryrange.Request) bool { if thanosReqStoreMatcherGettable, ok := r.(ThanosRequestStoreMatcherGetter); ok { if len(thanosReqStoreMatcherGettable.GetStoreMatchers()) > 0 {