Alerting: Allow disabling recording rules write for a data source in the UI (#106664)
Adds a new "Allow as recording rules target" toggle to Prometheus datasource configuration that controls whether the datasource can be selected as a target for writing recording rules. --------- Co-authored-by: ismail simsek <ismailsimsek09@gmail.com> Co-authored-by: Konrad Lalik <konradlalik@gmail.com>
This commit is contained in:
co-authored by
ismail simsek
Konrad Lalik
parent
6cb2c701e6
commit
f6e330b3d7
@@ -249,7 +249,8 @@ type FrontendSettingsDTO struct {
|
||||
|
||||
Azure FrontendSettingsAzureDTO `json:"azure"`
|
||||
|
||||
DefaultDatasourceManageAlertsUIToggle bool `json:"defaultDatasourceManageAlertsUiToggle"`
|
||||
DefaultDatasourceManageAlertsUIToggle bool `json:"defaultDatasourceManageAlertsUiToggle"`
|
||||
DefaultAllowRecordingRulesTargetAlertsUIToggle bool `json:"defaultAllowRecordingRulesTargetAlertsUiToggle"`
|
||||
|
||||
Caching FrontendSettingsCachingDTO `json:"caching"`
|
||||
RecordedQueries FrontendSettingsRecordedQueriesDTO `json:"recordedQueries"`
|
||||
|
||||
@@ -261,7 +261,8 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
|
||||
ExploreDefaultTimeOffset: hs.Cfg.ExploreDefaultTimeOffset,
|
||||
ExploreHideLogsDownload: hs.Cfg.ExploreHideLogsDownload,
|
||||
|
||||
DefaultDatasourceManageAlertsUIToggle: hs.Cfg.DefaultDatasourceManageAlertsUIToggle,
|
||||
DefaultDatasourceManageAlertsUIToggle: hs.Cfg.DefaultDatasourceManageAlertsUIToggle,
|
||||
DefaultAllowRecordingRulesTargetAlertsUIToggle: hs.Cfg.DefaultAllowRecordingRulesTargetAlertsUIToggle,
|
||||
|
||||
BuildInfo: dtos.FrontendSettingsBuildInfoDTO{
|
||||
HideVersion: hideVersion,
|
||||
|
||||
@@ -341,6 +341,9 @@ type Cfg struct {
|
||||
// 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
|
||||
// Default behavior for the "Allow as recording rules target" toggle when configuring a data source.
|
||||
// It only works if the data source's `jsonData.allowAsRecordingRulesTarget` prop does not contain a previously configured value.
|
||||
DefaultAllowRecordingRulesTargetAlertsUIToggle bool
|
||||
|
||||
// IP range access control
|
||||
IPRangeACEnabled bool
|
||||
@@ -1969,6 +1972,7 @@ func (cfg *Cfg) readDataSourcesSettings() {
|
||||
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)
|
||||
cfg.DefaultAllowRecordingRulesTargetAlertsUIToggle = datasources.Key("default_allow_recording_rules_target_alerts_ui_toggle").MustBool(true)
|
||||
}
|
||||
|
||||
func (cfg *Cfg) readDataSourceSecuritySettings() {
|
||||
|
||||
Reference in New Issue
Block a user