Skip to content

Commit

Permalink
QFE: fixing stats middleware when cache is enabled (#8046)
Browse files Browse the repository at this point in the history
* QFE: fixing stats middleware when cache is enabled

Signed-off-by: Pedro Tanaka <[email protected]>

* Clarify strange config parameter

Signed-off-by: Pedro Tanaka <[email protected]>

---------

Signed-off-by: Pedro Tanaka <[email protected]>
  • Loading branch information
pedro-stanaka authored Jan 15, 2025
1 parent caffc11 commit a3b78c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
## Unreleased

### Fixed
- [#8046](https://github.com/thanos-io/thanos/pull/8046) Query-Frontend: Fix query statistic reporting for range queries when caching is enabled.

- [#7978](https://github.com/thanos-io/thanos/pull/7978) Receive: Fix deadlock during local writes when `split-tenant-label-name` is used
- [#8016](https://github.com/thanos-io/thanos/pull/8016) Query Frontend: Fix @ modifier not being applied correctly on sub queries.
Expand Down
5 changes: 3 additions & 2 deletions cmd/thanos/query_frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ func runQueryFrontend(
return errors.Wrap(err, "initializing the query range cache config")
}
cfg.QueryRangeConfig.ResultsCacheConfig = &queryrange.ResultsCacheConfig{
Compression: cfg.CacheCompression,
CacheConfig: *cacheConfig,
Compression: cfg.CacheCompression,
CacheConfig: *cacheConfig,
CacheQueryableSamplesStats: cfg.CortexHandlerConfig.QueryStatsEnabled,
}
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/queryfrontend/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,12 @@ func (cfg *Config) Validate() error {
if cfg.QueryRangeConfig.SplitQueriesByInterval <= 0 && !cfg.isDynamicSplitSet() {
return errors.New("split queries or split threshold interval should be greater than 0 when caching is enabled")
}
if err := cfg.QueryRangeConfig.ResultsCacheConfig.Validate(querier.Config{}); err != nil {
// This is instantiated just to make the QFE config comply with validation against the Cortex Querier,
// but in Thanos we don't use this configuration at all.
ignoredQueryConfig := querier.Config{
EnablePerStepStats: cfg.QueryRangeConfig.ResultsCacheConfig.CacheQueryableSamplesStats,
}
if err := cfg.QueryRangeConfig.ResultsCacheConfig.Validate(ignoredQueryConfig); err != nil {
return errors.Wrap(err, "invalid ResultsCache config for query_range tripperware")
}
}
Expand Down

0 comments on commit a3b78c2

Please sign in to comment.