Skip to content

Commit 73fd16d

Browse files
Upgrade client-golang and introduce flag for restoring 'for' state
Signed-off-by: Anand Rajagopal <[email protected]>
1 parent 98d9dde commit 73fd16d

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

docs/configuration/config-file-reference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4855,6 +4855,10 @@ ring:
48554855
# ruler.enable-ha-evaluation is true.
48564856
# CLI flag: -ruler.liveness-check-timeout
48574857
[liveness_check_timeout: <duration> | default = 1s]
4858+
4859+
# If true, restores the `for` state of new rule groups added to an existing rule manager.
4860+
# CLI flag: -ruler.always-restore-new-rule-groups
4861+
[always_restore_new_rule_groups: <boolean> | default = false]
48584862
```
48594863
48604864
### `ruler_storage_config`

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ require (
4141
github.com/opentracing/opentracing-go v1.2.0
4242
github.com/pkg/errors v0.9.1
4343
github.com/prometheus/alertmanager v0.28.0
44-
github.com/prometheus/client_golang v1.21.0-rc.0
44+
github.com/prometheus/client_golang v1.21.1
4545
github.com/prometheus/client_model v0.6.1
4646
github.com/prometheus/common v0.62.0
4747
// Prometheus maps version 2.x.y to tags v0.x.y.

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,8 @@ github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqr
15731573
github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
15741574
github.com/prometheus/client_golang v1.21.0-rc.0 h1:bR+RxBlwcr4q8hXkgSOA/J18j6n0/qH0Gb0DH+8c+RY=
15751575
github.com/prometheus/client_golang v1.21.0-rc.0/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
1576+
github.com/prometheus/client_golang v1.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
1577+
github.com/prometheus/client_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
15761578
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
15771579
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
15781580
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=

pkg/ruler/compat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ func DefaultTenantManagerFactory(cfg Config, p Pusher, q storage.Queryable, engi
370370
DefaultRuleQueryOffset: func() time.Duration {
371371
return overrides.RulerQueryOffset(userID)
372372
},
373-
RestoreNewRuleGroups: true,
373+
RestoreNewRuleGroups: cfg.AlwaysRestoreNewRuleGroups,
374374
}), nil
375375
}
376376
}

pkg/ruler/ruler.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,9 @@ type Config struct {
170170
EnableQueryStats bool `yaml:"query_stats_enabled"`
171171
DisableRuleGroupLabel bool `yaml:"disable_rule_group_label"`
172172

173-
EnableHAEvaluation bool `yaml:"enable_ha_evaluation"`
174-
LivenessCheckTimeout time.Duration `yaml:"liveness_check_timeout"`
173+
EnableHAEvaluation bool `yaml:"enable_ha_evaluation"`
174+
LivenessCheckTimeout time.Duration `yaml:"liveness_check_timeout"`
175+
AlwaysRestoreNewRuleGroups bool `yaml:"always_restore_new_rule_groups"`
175176
}
176177

177178
// Validate config and returns error on failure
@@ -254,7 +255,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
254255

255256
f.BoolVar(&cfg.EnableHAEvaluation, "ruler.enable-ha-evaluation", false, "Enable high availability")
256257
f.DurationVar(&cfg.LivenessCheckTimeout, "ruler.liveness-check-timeout", 1*time.Second, "Timeout duration for non-primary rulers during liveness checks. If the check times out, the non-primary ruler will evaluate the rule group. Applicable when ruler.enable-ha-evaluation is true.")
257-
258+
f.BoolVar(&cfg.AlwaysRestoreNewRuleGroups, "ruler.always-restore-new-rule-groups", false, "When enabled, ruler will always restore the `for` state of new rule groups")
258259
cfg.RingCheckPeriod = 5 * time.Second
259260
}
260261

0 commit comments

Comments
 (0)