Skip to content

Commit 2a22435

Browse files
committed
QFE: fixing stats middleware when cache is enabled
Signed-off-by: Pedro Tanaka <[email protected]>
1 parent 7037331 commit 2a22435

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
1111
## Unreleased
1212

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

1516
### Added
1617

cmd/thanos/query_frontend.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,9 @@ func runQueryFrontend(
270270
return errors.Wrap(err, "initializing the query range cache config")
271271
}
272272
cfg.QueryRangeConfig.ResultsCacheConfig = &queryrange.ResultsCacheConfig{
273-
Compression: cfg.CacheCompression,
274-
CacheConfig: *cacheConfig,
273+
Compression: cfg.CacheCompression,
274+
CacheConfig: *cacheConfig,
275+
CacheQueryableSamplesStats: cfg.CortexHandlerConfig.QueryStatsEnabled,
275276
}
276277
}
277278

pkg/queryfrontend/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ func (cfg *Config) Validate() error {
256256
if cfg.QueryRangeConfig.SplitQueriesByInterval <= 0 && !cfg.isDynamicSplitSet() {
257257
return errors.New("split queries or split threshold interval should be greater than 0 when caching is enabled")
258258
}
259-
if err := cfg.QueryRangeConfig.ResultsCacheConfig.Validate(querier.Config{}); err != nil {
259+
if err := cfg.QueryRangeConfig.ResultsCacheConfig.Validate(querier.Config{
260+
EnablePerStepStats: cfg.QueryRangeConfig.ResultsCacheConfig.CacheQueryableSamplesStats,
261+
}); err != nil {
260262
return errors.Wrap(err, "invalid ResultsCache config for query_range tripperware")
261263
}
262264
}

0 commit comments

Comments
 (0)