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

Add a flag to disable step alignment middleware #3356

Merged
merged 4 commits into from Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -20,6 +20,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#3346](https://github.com/thanos-io/thanos/pull/3346) Ruler UI: Fix a bug preventing the /rules endpoint from loading.
- [#3115](https://github.com/thanos-io/thanos/pull/3115) compact: now deletes partially uploaded and blocks with deletion marks concurrently. It does that at the beginning and then every `--compact.cleanup-interval` time period. By default it is 5 minutes.
- [#3312](https://github.com/thanos-io/thanos/pull/3312) s3: add list_objects_version config option for compatibility.
- [#3356](https://github.com/thanos-io/thanos/pull/3356) Query Frontend: Add a flag to disable step alignment middleware for query range.

### Fixed
- [#3257](https://github.com/thanos-io/thanos/pull/3257) Ruler: Prevent Ruler from crashing when using default DNS to lookup hosts that results in "No such hosts" errors.
Expand Down
3 changes: 3 additions & 0 deletions cmd/thanos/query_frontend.go
Expand Up @@ -57,6 +57,9 @@ func registerQueryFrontend(app *extkingpin.App) {
cfg.http.registerFlag(cmd)

// Query range tripperware flags.
cmd.Flag("query-range.align-range-with-step", "Mutate incoming queries to align their start and end with their step for better cache-ability. Note: Grafana dashboards do that by default.").
Default("true").BoolVar(&cfg.QueryRangeConfig.AlignRangeWithStep)

cmd.Flag("query-range.split-interval", "Split query range requests by an interval and execute in parallel, it should be greater than 0 when query-range.response-cache-config is configured.").
Default("24h").DurationVar(&cfg.QueryRangeConfig.SplitQueriesByInterval)

Expand Down
5 changes: 5 additions & 0 deletions docs/components/query-frontend.md
Expand Up @@ -126,6 +126,11 @@ Flags:
Listen host:port for HTTP endpoints.
--http-grace-period=2m Time to wait after an interrupt received for
HTTP Server.
--query-range.align-range-with-step
Mutate incoming queries to align their start
and end with their step for better
cache-ability. Note: Grafana dashboards do that
by default.
--query-range.split-interval=24h
Split query range requests by an interval and
execute in parallel, it should be greater than
Expand Down
1 change: 1 addition & 0 deletions pkg/queryfrontend/config.go
Expand Up @@ -139,6 +139,7 @@ type QueryRangeConfig struct {
ResultsCacheConfig *queryrange.ResultsCacheConfig
CachePathOrContent extflag.PathOrContent

AlignRangeWithStep bool
SplitQueriesByInterval time.Duration
MaxRetries int
Limits *cortexvalidation.Limits
Expand Down
12 changes: 7 additions & 5 deletions pkg/queryfrontend/roundtrip.go
Expand Up @@ -144,11 +144,13 @@ func newQueryRangeTripperware(
m := queryrange.NewInstrumentMiddlewareMetrics(reg)

// step align middleware.
queryRangeMiddleware = append(
queryRangeMiddleware,
queryrange.InstrumentMiddleware("step_align", m),
queryrange.StepAlignMiddleware,
)
if config.AlignRangeWithStep {
queryRangeMiddleware = append(
queryRangeMiddleware,
queryrange.InstrumentMiddleware("step_align", m),
queryrange.StepAlignMiddleware,
)
}

queryIntervalFn := func(_ queryrange.Request) time.Duration {
return config.SplitQueriesByInterval
Expand Down