Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QFE: fixing stats middleware when cache is enabled #8046

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

### Added

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
4 changes: 3 additions & 1 deletion pkg/queryfrontend/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ 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 {
if err := cfg.QueryRangeConfig.ResultsCacheConfig.Validate(querier.Config{
EnablePerStepStats: cfg.QueryRangeConfig.ResultsCacheConfig.CacheQueryableSamplesStats,
}); err != nil {
Copy link
Contributor Author

@pedro-stanaka pedro-stanaka Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to do this because of validation of parameters in Cortex QFE code. They compare QFE config against Cortex Querier config. But we ignore/dont use that querier config, so I had to force that to pass validation. Or I can delete the validation piece, but then we will have to touch vendored code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can extract the config in a variable to make it a bit more readable, and add a short comment above it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. done

return errors.Wrap(err, "invalid ResultsCache config for query_range tripperware")
}
}
Expand Down
Loading