Alerting: Add setting to distribute rule group evaluations over time (#80766)

* Simple, per-base-interval jitter

* Add log just for test purposes

* Add strategy approach, allow choosing between group or rule

* Add flag to jitter rules

* Add second toggle for jittering within a group

* Wire up toggles to strategy

* Slightly improve comment ordering

* Add tests for offset generation

* Rename JitterStrategyFrom

* Improve debug log message

* Use grafana SDK labels rather than prometheus labels
This commit is contained in:
Alexander Weaver
2024-01-18 12:48:11 -06:00
committed by GitHub
parent 94c3be3b49
commit 00a260effa
10 changed files with 216 additions and 1 deletions
+6
View File
@@ -186,6 +186,12 @@ func WithInterval(interval time.Duration) AlertRuleMutator {
}
}
func WithIntervalBetween(min, max int64) AlertRuleMutator {
return func(rule *AlertRule) {
rule.IntervalSeconds = rand.Int63n(max-min) + min
}
}
func WithTitle(title string) AlertRuleMutator {
return func(rule *AlertRule) {
rule.Title = title