|
5 | 5 | "encoding/json"
|
6 | 6 | "errors"
|
7 | 7 | "flag"
|
| 8 | + "github.com/go-kit/log/level" |
8 | 9 | "math"
|
9 | 10 | "regexp"
|
10 | 11 | "strings"
|
@@ -174,6 +175,7 @@ type Limits struct {
|
174 | 175 | QueryRejection QueryRejection `yaml:"query_rejection" json:"query_rejection" doc:"nocli|description=Configuration for query rejection."`
|
175 | 176 |
|
176 | 177 | // Ruler defaults and limits.
|
| 178 | + RulerEvaluationDelay model.Duration `yaml:"ruler_evaluation_delay_duration" json:"ruler_evaluation_delay_duration"` |
177 | 179 | RulerTenantShardSize int `yaml:"ruler_tenant_shard_size" json:"ruler_tenant_shard_size"`
|
178 | 180 | RulerMaxRulesPerRuleGroup int `yaml:"ruler_max_rules_per_rule_group" json:"ruler_max_rules_per_rule_group"`
|
179 | 181 | RulerMaxRuleGroupsPerTenant int `yaml:"ruler_max_rule_groups_per_tenant" json:"ruler_max_rule_groups_per_tenant"`
|
@@ -212,7 +214,6 @@ type Limits struct {
|
212 | 214 | // RegisterFlags adds the flags required to config this to the given FlagSet
|
213 | 215 | func (l *Limits) RegisterFlags(f *flag.FlagSet) {
|
214 | 216 | flagext.DeprecatedFlag(f, "ingester.max-series-per-query", "Deprecated: The maximum number of series for which a query can fetch samples from each ingester. This limit is enforced only in the ingesters (when querying samples not flushed to the storage yet) and it's a per-instance limit. This limit is ignored when running the Cortex blocks storage. When running Cortex with blocks storage use -querier.max-fetched-series-per-query limit instead.", util_log.Logger)
|
215 |
| - flagext.DeprecatedFlag(f, "ruler.evaluation-delay-duration", "Deprecated: Duration to delay the evaluation of rules to ensure the underlying metrics have been pushed to Cortex. This limit was replaced by ruler.query-offset", util_log.Logger) |
216 | 217 |
|
217 | 218 | f.IntVar(&l.IngestionTenantShardSize, "distributor.ingestion-tenant-shard-size", 0, "The default tenant's shard size when the shuffle-sharding strategy is used. Must be set both on ingesters and distributors. When this setting is specified in the per-tenant overrides, a value of 0 disables shuffle sharding for the tenant.")
|
218 | 219 | f.Float64Var(&l.IngestionRate, "distributor.ingestion-rate-limit", 25000, "Per-user ingestion rate limit in samples per second.")
|
@@ -265,6 +266,7 @@ func (l *Limits) RegisterFlags(f *flag.FlagSet) {
|
265 | 266 |
|
266 | 267 | f.IntVar(&l.MaxOutstandingPerTenant, "frontend.max-outstanding-requests-per-tenant", 100, "Maximum number of outstanding requests per tenant per request queue (either query frontend or query scheduler); requests beyond this error with HTTP 429.")
|
267 | 268 |
|
| 269 | + f.Var(&l.RulerEvaluationDelay, "ruler.evaluation-delay-duration", "Deprecated(use ruler.query-offset instead) and will be removed in v1.19.0: Duration to delay the evaluation of rules to ensure the underlying metrics have been pushed to Cortex.") |
268 | 270 | f.IntVar(&l.RulerTenantShardSize, "ruler.tenant-shard-size", 0, "The default tenant's shard size when the shuffle-sharding strategy is used by ruler. When this setting is specified in the per-tenant overrides, a value of 0 disables shuffle sharding for the tenant.")
|
269 | 271 | f.IntVar(&l.RulerMaxRulesPerRuleGroup, "ruler.max-rules-per-rule-group", 0, "Maximum number of rules per rule group per-tenant. 0 to disable.")
|
270 | 272 | f.IntVar(&l.RulerMaxRuleGroupsPerTenant, "ruler.max-rule-groups-per-tenant", 0, "Maximum number of rule groups per-tenant. 0 to disable.")
|
@@ -789,7 +791,13 @@ func (o *Overrides) RulerMaxRuleGroupsPerTenant(userID string) int {
|
789 | 791 |
|
790 | 792 | // RulerQueryOffset returns the rule query offset for a given user.
|
791 | 793 | func (o *Overrides) RulerQueryOffset(userID string) time.Duration {
|
792 |
| - return time.Duration(o.GetOverridesForUser(userID).RulerQueryOffset) |
| 794 | + ruleOffset := time.Duration(o.GetOverridesForUser(userID).RulerQueryOffset) |
| 795 | + evaluationDelay := time.Duration(o.GetOverridesForUser(userID).RulerEvaluationDelay) |
| 796 | + if evaluationDelay > ruleOffset { |
| 797 | + level.Warn(util_log.Logger).Log("msg", "ruler.query-offset was overridden by highest value in [Deprecated]ruler.evaluation-delay-duration", "ruler.query-offset", ruleOffset, "ruler.evaluation-delay-duration", evaluationDelay) |
| 798 | + return evaluationDelay |
| 799 | + } |
| 800 | + return ruleOffset |
793 | 801 | }
|
794 | 802 |
|
795 | 803 | // StoreGatewayTenantShardSize returns the store-gateway shard size for a given user.
|
|
0 commit comments