Alerting: Make Unified Alerting enabled by default for those who do not use legacy alerting (#42200)
* update AlertingEnabled and UnifiedAlertingSettings.Enabled to be pointers * add a pseudo migration to fix the AlertingEnabled and UnifiedAlertingSettings.Enabled if the latter is not defined * update the default configuration file to make default value for both 'enabled' flags be undefined Misc * update Migrator to expose DB engine. This is needed for a ualert migration to access the database while the list of migrations is created. * add more verbose failure when migrations do not match Co-authored-by: gotjosh <josue@grafana.com> Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com> Co-authored-by: gillesdemey <gilles.de.mey@gmail.com>
This commit is contained in:
co-authored by
gotjosh
Yuriy Tseretyan
gillesdemey
parent
1c261aea8e
commit
6523486122
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana-aws-sdk/pkg/awsds"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/gtime"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
|
||||
@@ -153,7 +154,7 @@ var (
|
||||
Quota QuotaSettings
|
||||
|
||||
// Alerting
|
||||
AlertingEnabled bool
|
||||
AlertingEnabled *bool
|
||||
ExecuteAlerts bool
|
||||
AlertingRenderLimit int
|
||||
AlertingErrorOrTimeout string
|
||||
@@ -914,9 +915,6 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
|
||||
if err := readAlertingSettings(iniFile); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := cfg.ReadUnifiedAlertingSettings(iniFile); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
explore := iniFile.Section("explore")
|
||||
ExploreEnabled = explore.Key("enabled").MustBool(true)
|
||||
@@ -1377,7 +1375,11 @@ func (cfg *Cfg) readFeatureToggles(iniFile *ini.File) error {
|
||||
|
||||
func readAlertingSettings(iniFile *ini.File) error {
|
||||
alerting := iniFile.Section("alerting")
|
||||
AlertingEnabled = alerting.Key("enabled").MustBool(true)
|
||||
enabled, err := alerting.Key("enabled").Bool()
|
||||
AlertingEnabled = nil
|
||||
if err == nil {
|
||||
AlertingEnabled = &enabled
|
||||
}
|
||||
ExecuteAlerts = alerting.Key("execute_alerts").MustBool(true)
|
||||
AlertingRenderLimit = alerting.Key("concurrent_render_limit").MustInt(5)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user