Datasources: Add toggle to control default behaviour of 'Manage alerts via Alerts UI' toggle (#98441)

* Datasources: Add toggle to control default behaviour of 'Manage alerts via Alerts UI' toggle

* Update documentation with suggestions

Co-authored-by: Larissa Wandzura <126723338+lwandz13@users.noreply.github.com>
This commit is contained in:
Matheus Macabu
2025-01-10 15:20:09 +01:00
committed by GitHub
co-authored by Larissa Wandzura
parent ac2345a3c0
commit 4e398bf2bd
10 changed files with 79 additions and 2 deletions
+2
View File
@@ -242,6 +242,8 @@ type FrontendSettingsDTO struct {
Azure FrontendSettingsAzureDTO `json:"azure"`
DefaultDatasourceManageAlertsUIToggle bool `json:"defaultDatasourceManageAlertsUiToggle"`
Caching FrontendSettingsCachingDTO `json:"caching"`
RecordedQueries FrontendSettingsRecordedQueriesDTO `json:"recordedQueries"`
Reporting FrontendSettingsReportingDTO `json:"reporting"`
+2
View File
@@ -245,6 +245,8 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
ReportingStaticContext: hs.Cfg.ReportingStaticContext,
ExploreDefaultTimeOffset: hs.Cfg.ExploreDefaultTimeOffset,
DefaultDatasourceManageAlertsUIToggle: hs.Cfg.DefaultDatasourceManageAlertsUIToggle,
BuildInfo: dtos.FrontendSettingsBuildInfoDTO{
HideVersion: hideVersion,
Version: version,
+4
View File
@@ -330,6 +330,9 @@ type Cfg struct {
DataSourceLimit int
// Number of queries to be executed concurrently. Only for the datasource supports concurrency.
ConcurrentQueryCount int
// Default behavior for the "Manage alerts via Alerting UI" toggle when configuring a data source.
// It only works if the data source's `jsonData.manageAlerts` prop does not contain a previously configured value.
DefaultDatasourceManageAlertsUIToggle bool
// IP range access control
IPRangeACEnabled bool
@@ -1914,6 +1917,7 @@ func (cfg *Cfg) readDataSourcesSettings() {
datasources := cfg.Raw.Section("datasources")
cfg.DataSourceLimit = datasources.Key("datasource_limit").MustInt(5000)
cfg.ConcurrentQueryCount = datasources.Key("concurrent_query_count").MustInt(10)
cfg.DefaultDatasourceManageAlertsUIToggle = datasources.Key("default_manage_alerts_ui_toggle").MustBool(true)
}
func (cfg *Cfg) readDataSourceSecuritySettings() {