-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Move cortex' querier split_queries_by_interval to limits config #5184
Conversation
2a5cf06
to
305e520
Compare
@@ -52,6 +52,7 @@ var ( | |||
|
|||
// Config for query_range middleware chain. | |||
type Config struct { | |||
// Deprecated: SplitQueriesByInterval will be removed in the next major release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we keep track of the flags that will be deprecated on follow-up releases? Should one issue be created to remind us of this flag? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we do any logging around use of deprecated fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have flagext.DeprecatedFlag(
from dskit log a warning. So worth looking into that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyriltovena set the flag with flagext.DeprecatedFlag
on commit c99dd51
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we move the same flag to the limits struct, we don't need to deprecate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in commit: d35fcf3
195a515
to
161f8b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! My only question is why deprecate the old flag and introduce a new one vs changing where the flag is registered into limits.go
? Seems less disruptive to me to do the latter since it achieves the same outcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, but left some suggestions.
res.splitDuration = conf.SplitQueriesByInterval | ||
} | ||
// Set as the default split by interval value | ||
res.splitDuration = l.QuerySplitDurationDefault() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to remove res.splitDuration
now, since it'll be automatically covered in the underlying Limits
impl. Previously we needed to support tenant override > tenant default > global default
, but we've removed global default
and we already handle the first two in the underlying implementation: https://github.com/grafana/loki/blob/main/pkg/validation/limits.go#L530-L538
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, +1 to this as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owen-d I don't think we can remove res.splitDuration
because of function WithSplitByLimits:
loki/pkg/querier/queryrange/limits.go
Lines 82 to 87 in d35fcf3
func WithSplitByLimits(l Limits, splitBy time.Duration) Limits { | |
return limits{ | |
Limits: l, | |
splitDuration: splitBy, | |
} | |
} |
used to force a 24-hour split in the query range middleware of the
NewSeriesTripperware
and NewLabelsTripperware
pkg/querier/queryrange/limits.go
Outdated
if conf.SplitQueriesByInterval != 0 { | ||
res.splitDuration = conf.SplitQueriesByInterval | ||
level.Warn(util_log.Logger).Log("deprecated", "yaml flag 'query_range.split_queries_by_interval' is deprecated, use yaml flag 'limits_config.split_queries_by_interval' or CLI flag -querier.split-queries-by-interval instead.", | ||
"default split_queries_by_interval", l.QuerySplitDurationDefault()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For users currently using the config file, setting res.splitDuration = conf.SplitQueriesByInterval
has no effect here. Since limits now contain a default value (30 minutes), this will always be returned, meaning clause:
loki/pkg/querier/queryrange/limits.go
Lines 54 to 56 in 87cbe50
if dur == 0 { | |
return l.splitDuration | |
} |
will never be reached.
Therefore, for users currently using the config file (while the flag is not removed), I see two options:
- global default value of 30 minutes is overwritten by the value of
conf.SplitQueriesByInterval
- Solution here implemented: simply log a warning and use the default value of 30 minutes
What do you think?
faa9a0e
to
411a5ff
Compare
411a5ff
to
8399387
Compare
Closing in favor of #5243 |
What this PR does / why we need it:
Move
split_queries_by_interval
config from cortex' queryrange package to limits config.Special notes for your reviewer:
Checklist
CHANGELOG.md
about the changes.