Skip to content

Commit 8ef389c

Browse files
Increase LivenessCheck timeout
Signed-off-by: Anand Rajagopal <[email protected]>
1 parent d829d65 commit 8ef389c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

docs/configuration/config-file-reference.md

+4
Original file line numberDiff line numberDiff line change
@@ -4460,6 +4460,10 @@ ring:
44604460
# Enable high availability
44614461
# CLI flag: -ruler.enable-ha-evaluation
44624462
[enable_ha_evaluation: <boolean> | default = false]
4463+
4464+
# Liveness check timeout
4465+
# CLI flag: -ruler.liveness-check-timeout
4466+
[liveness_check_timeout: <duration> | default = 1s]
44634467
```
44644468

44654469
### `ruler_storage_config`

pkg/ruler/ruler.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ const (
8181
unknownHealthFilter string = "unknown"
8282
okHealthFilter string = "ok"
8383
errHealthFilter string = "err"
84-
85-
livenessCheckTimeout = 100 * time.Millisecond
8684
)
8785

8886
type DisabledRuleGroupErr struct {
@@ -161,7 +159,8 @@ type Config struct {
161159
EnableQueryStats bool `yaml:"query_stats_enabled"`
162160
DisableRuleGroupLabel bool `yaml:"disable_rule_group_label"`
163161

164-
EnableHAEvaluation bool `yaml:"enable_ha_evaluation"`
162+
EnableHAEvaluation bool `yaml:"enable_ha_evaluation"`
163+
LivenessCheckTimeout time.Duration `yaml:"liveness_check_timeout"`
165164
}
166165

167166
// Validate config and returns error on failure
@@ -238,6 +237,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
238237
f.BoolVar(&cfg.DisableRuleGroupLabel, "ruler.disable-rule-group-label", false, "Disable the rule_group label on exported metrics")
239238

240239
f.BoolVar(&cfg.EnableHAEvaluation, "ruler.enable-ha-evaluation", false, "Enable high availability")
240+
f.DurationVar(&cfg.LivenessCheckTimeout, "ruler.liveness-check-timeout", 1*time.Second, "Liveness check timeout")
241241

242242
cfg.RingCheckPeriod = 5 * time.Second
243243
}
@@ -590,7 +590,7 @@ func (r *Ruler) nonPrimaryInstanceOwnsRuleGroup(g *rulespb.RuleGroupDesc, replic
590590
responseChan := make(chan *LivenessCheckResponse, len(jobs))
591591

592592
ctx := user.InjectOrgID(context.Background(), userID)
593-
ctx, cancel := context.WithTimeout(ctx, livenessCheckTimeout)
593+
ctx, cancel := context.WithTimeout(ctx, r.cfg.LivenessCheckTimeout)
594594
defer cancel()
595595

596596
err := concurrency.ForEach(ctx, jobs, len(jobs), func(ctx context.Context, job interface{}) error {

0 commit comments

Comments
 (0)