Alerting: Remove legacy alerting (#83671)

Removes legacy alerting, so long and thanks for all the fish! 🐟

---------

Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
Co-authored-by: Sonia Aguilar <soniaAguilarPeiron@users.noreply.github.com>
Co-authored-by: Armand Grillet <armandgrillet@users.noreply.github.com>
Co-authored-by: William Wernert <rwwiv@users.noreply.github.com>
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
This commit is contained in:
Gilles De Mey
2024-03-14 15:36:35 +01:00
committed by GitHub
parent f26344e176
commit 8765c48389
298 changed files with 540 additions and 45125 deletions

View File

@@ -360,9 +360,6 @@ type Cfg struct {
LocalFileSystemAvailable bool
// Deprecated
ForceMigration bool
// Analytics
CheckForGrafanaUpdates bool
CheckForPluginUpdates bool
@@ -503,12 +500,6 @@ type Cfg struct {
FeatureManagement FeatureMgmtSettings
// Alerting
AlertingEnabled *bool
ExecuteAlerts bool
AlertingRenderLimit int
AlertingErrorOrTimeout string
AlertingNoDataOrNullValues string
AlertingEvaluationTimeout time.Duration
AlertingNotificationTimeout time.Duration
AlertingMaxAttempts int
@@ -1068,8 +1059,6 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error {
cfg.StackID = valueAsString(iniFile.Section("environment"), "stack_id", "")
cfg.Slug = valueAsString(iniFile.Section("environment"), "stack_slug", "")
cfg.LocalFileSystemAvailable = iniFile.Section("environment").Key("local_file_system_available").MustBool(true)
//nolint:staticcheck
cfg.ForceMigration = iniFile.Section("").Key("force_migration").MustBool(false)
cfg.InstanceName = valueAsString(iniFile.Section(""), "instance_name", "unknown_instance_name")
plugins := valueAsString(iniFile.Section("paths"), "plugins", "")
cfg.PluginsPath = makeAbsolute(plugins, cfg.HomePath)
@@ -1761,12 +1750,6 @@ func (cfg *Cfg) readAlertingSettings(iniFile *ini.File) error {
return nil
}
// IsLegacyAlertingEnabled returns whether the legacy alerting is enabled or not.
// It's safe to be used only after readAlertingSettings() and ReadUnifiedAlertingSettings() are executed.
func (cfg *Cfg) IsLegacyAlertingEnabled() bool {
return cfg.AlertingEnabled != nil && *(cfg.AlertingEnabled)
}
func readGRPCServerSettings(cfg *Cfg, iniFile *ini.File) error {
server := iniFile.Section("grpc_server")
errPrefix := "grpc_server:"

View File

@@ -96,7 +96,6 @@ type UnifiedAlertingSettings struct {
ReservedLabels UnifiedAlertingReservedLabelSettings
StateHistory UnifiedAlertingStateHistorySettings
RemoteAlertmanager RemoteAlertmanagerSettings
Upgrade UnifiedAlertingUpgradeSettings
// MaxStateSaveConcurrency controls the number of goroutines (per rule) that can save alert state in parallel.
MaxStateSaveConcurrency int
StatePeriodicSaveInterval time.Duration
@@ -140,11 +139,6 @@ type UnifiedAlertingStateHistorySettings struct {
ExternalLabels map[string]string
}
type UnifiedAlertingUpgradeSettings struct {
// CleanUpgrade controls whether the upgrade process should clean up UA data when upgrading from legacy alerting.
CleanUpgrade bool
}
// IsEnabled returns true if UnifiedAlertingSettings.Enabled is either nil or true.
// It hides the implementation details of the Enabled and simplifies its usage.
func (u *UnifiedAlertingSettings) IsEnabled() bool {
@@ -381,12 +375,6 @@ func (cfg *Cfg) ReadUnifiedAlertingSettings(iniFile *ini.File) error {
return err
}
upgrade := iniFile.Section("unified_alerting.upgrade")
uaCfgUpgrade := UnifiedAlertingUpgradeSettings{
CleanUpgrade: upgrade.Key("clean_upgrade").MustBool(false),
}
uaCfg.Upgrade = uaCfgUpgrade
cfg.UnifiedAlerting = uaCfg
return nil
}