Alerting: replace a duplicated configuration key (#50350)

This PR renames the configuration key enabled to capture. This is needed as we already have a configuration key with the name enabled.

Fixes #50328

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
This commit is contained in:
Jean-Philippe Quéméner
2022-06-08 05:04:51 +02:00
committed by GitHub
parent 28a47b56d2
commit fd664e4beb
3 changed files with 5 additions and 5 deletions

View File

@ -844,7 +844,7 @@ min_interval = 10s
[unified_alerting.screenshots] [unified_alerting.screenshots]
# Enable screenshots in notifications. This option requires a remote HTTP image rendering service. Please # Enable screenshots in notifications. This option requires a remote HTTP image rendering service. Please
# see [rendering] for further configuration options. # see [rendering] for further configuration options.
enabled = capture = false
# The maximum number of screenshots that can be taken at the same time. This option is different from # The maximum number of screenshots that can be taken at the same time. This option is different from
# concurrent_render_request_limit as max_concurrent_screenshots sets the number of concurrent screenshots # concurrent_render_request_limit as max_concurrent_screenshots sets the number of concurrent screenshots

View File

@ -55,7 +55,7 @@ func NewScreenshotImageService(screenshots screenshot.ScreenshotService, store s
// from the configuration. // from the configuration.
func NewScreenshotImageServiceFromCfg(cfg *setting.Cfg, metrics prometheus.Registerer, func NewScreenshotImageServiceFromCfg(cfg *setting.Cfg, metrics prometheus.Registerer,
db *store.DBstore, ds dashboards.DashboardService, rs rendering.Service) (ImageService, error) { db *store.DBstore, ds dashboards.DashboardService, rs rendering.Service) (ImageService, error) {
if !cfg.UnifiedAlerting.Screenshots.Enabled { if !cfg.UnifiedAlerting.Screenshots.Capture {
return &ScreenshotImageService{ return &ScreenshotImageService{
screenshots: &screenshot.ScreenshotUnavailableService{}, screenshots: &screenshot.ScreenshotUnavailableService{},
}, nil }, nil

View File

@ -48,7 +48,7 @@ const (
schedulereDefaultExecuteAlerts = true schedulereDefaultExecuteAlerts = true
schedulerDefaultMaxAttempts = 3 schedulerDefaultMaxAttempts = 3
schedulerDefaultLegacyMinInterval = 1 schedulerDefaultLegacyMinInterval = 1
screenshotsDefaultEnabled = false screenshotsDefaultCapture = false
screenshotsDefaultMaxConcurrent = 5 screenshotsDefaultMaxConcurrent = 5
screenshotsDefaultUploadImageStorage = false screenshotsDefaultUploadImageStorage = false
// SchedulerBaseInterval base interval of the scheduler. Controls how often the scheduler fetches database for new changes as well as schedules evaluation of a rule // SchedulerBaseInterval base interval of the scheduler. Controls how often the scheduler fetches database for new changes as well as schedules evaluation of a rule
@ -84,7 +84,7 @@ type UnifiedAlertingSettings struct {
} }
type UnifiedAlertingScreenshotSettings struct { type UnifiedAlertingScreenshotSettings struct {
Enabled bool Capture bool
MaxConcurrentScreenshots int64 MaxConcurrentScreenshots int64
UploadExternalImageStorage bool UploadExternalImageStorage bool
} }
@ -260,7 +260,7 @@ func (cfg *Cfg) ReadUnifiedAlertingSettings(iniFile *ini.File) error {
screenshots := iniFile.Section("unified_alerting.screenshots") screenshots := iniFile.Section("unified_alerting.screenshots")
uaCfgScreenshots := uaCfg.Screenshots uaCfgScreenshots := uaCfg.Screenshots
uaCfgScreenshots.Enabled = screenshots.Key("enabled").MustBool(screenshotsDefaultEnabled) uaCfgScreenshots.Capture = screenshots.Key("capture").MustBool(screenshotsDefaultCapture)
uaCfgScreenshots.MaxConcurrentScreenshots = screenshots.Key("max_concurrent_screenshots").MustInt64(screenshotsDefaultMaxConcurrent) uaCfgScreenshots.MaxConcurrentScreenshots = screenshots.Key("max_concurrent_screenshots").MustInt64(screenshotsDefaultMaxConcurrent)
uaCfgScreenshots.UploadExternalImageStorage = screenshots.Key("upload_external_image_storage").MustBool(screenshotsDefaultUploadImageStorage) uaCfgScreenshots.UploadExternalImageStorage = screenshots.Key("upload_external_image_storage").MustBool(screenshotsDefaultUploadImageStorage)
uaCfg.Screenshots = uaCfgScreenshots uaCfg.Screenshots = uaCfgScreenshots