[v9.5.x] Alerting: Support concurrent queries for saving alert instances (#70921)

* Alerting: Support concurrent queries for saving alert instances (#70525)

This commit adds support for concurrent queries when saving alert
instances to the database. This is an experimental feature in
response to some customers experiencing delays between rule evaluation
and sending alerts to Alertmanager, resulting in flapping. It is
disabled by default.

(cherry picked from commit 7edbe72483)

* Trigger PR automation

---------

Co-authored-by: George Robinson <george.robinson@grafana.com>
This commit is contained in:
Santiago
2023-08-16 08:17:52 +01:00
committed by GitHub
co-authored by George Robinson
parent c1ef527b0b
commit 759dd42abf
9 changed files with 124 additions and 92 deletions
+4
View File
@@ -86,6 +86,8 @@ type UnifiedAlertingSettings struct {
Screenshots UnifiedAlertingScreenshotSettings
ReservedLabels UnifiedAlertingReservedLabelSettings
StateHistory UnifiedAlertingStateHistorySettings
// MaxStateSaveConcurrency controls the number of goroutines (per rule) that can save alert state in parallel.
MaxStateSaveConcurrency int
}
type UnifiedAlertingScreenshotSettings struct {
@@ -338,6 +340,8 @@ func (cfg *Cfg) ReadUnifiedAlertingSettings(iniFile *ini.File) error {
}
uaCfg.StateHistory = uaCfgStateHistory
uaCfg.MaxStateSaveConcurrency = ua.Key("max_state_save_concurrency").MustInt(1)
cfg.UnifiedAlerting = uaCfg
return nil
}