Alerting: Add un-documented toggle for changing state history backend, add shells for remote loki and sql (#61072)

* Add toggle for state history backend and shells

* Extract some shared logic and add tests
This commit is contained in:
Alexander Weaver
2023-01-06 12:06:01 -06:00
committed by GitHub
parent cd04f4e564
commit eb960d9725
8 changed files with 256 additions and 64 deletions

View File

@@ -102,6 +102,7 @@ type UnifiedAlertingReservedLabelSettings struct {
type UnifiedAlertingStateHistorySettings struct {
Enabled bool
Backend string
}
// IsEnabled returns true if UnifiedAlertingSettings.Enabled is either nil or true.
@@ -313,6 +314,7 @@ func (cfg *Cfg) ReadUnifiedAlertingSettings(iniFile *ini.File) error {
stateHistory := iniFile.Section("unified_alerting.state_history")
uaCfgStateHistory := UnifiedAlertingStateHistorySettings{
Enabled: stateHistory.Key("enabled").MustBool(stateHistoryDefaultEnabled),
Backend: stateHistory.Key("backend").MustString("annotations"),
}
uaCfg.StateHistory = uaCfgStateHistory