Skip to content

Commit

Permalink
Move info about queries that skip cache logic to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascamata committed Apr 26, 2022
1 parent 44011f8 commit f85505b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/components/query-frontend.md
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions pkg/queryfrontend/roundtrip.go
Expand Up @@ -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 {
Expand Down

0 comments on commit f85505b

Please sign in to comment.