[v10.0.x] Alerting: Support concurrent queries for saving alert instances (#70869)

* 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)

* remove changes in api_testing.go

---------

Co-authored-by: George Robinson <george.robinson@grafana.com>
This commit is contained in:
Santiago
2023-06-28 21:38:17 -03:00
committed by GitHub
co-authored by George Robinson
parent b2d43decb3
commit 30255fd4bd
9 changed files with 124 additions and 92 deletions
+4
View File
@@ -92,6 +92,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 {
@@ -350,6 +352,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
}