mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Prevent inhibition rules in Grafana Alertmanager (#81712)
This commit prevents saving configurations containing inhibition rules in Grafana Alertmanager. It does not reject inhibition rules when using external Alertmanagers, such as Mimir. This meant the validation had to be put in the MultiOrgAlertmanager instead of in the validation of PostableUserConfig. We can remove this when inhibition rules are supported in Grafana Managed Alerts.
This commit is contained in:
@@ -156,6 +156,13 @@ func (moa *MultiOrgAlertmanager) gettableUserConfigFromAMConfigString(ctx contex
|
||||
}
|
||||
|
||||
func (moa *MultiOrgAlertmanager) ApplyAlertmanagerConfiguration(ctx context.Context, org int64, config definitions.PostableUserConfig) error {
|
||||
// We cannot add this validation to PostableUserConfig as that struct is used for both
|
||||
// Grafana Alertmanager (where inhibition rules are not supported) and External Alertmanagers
|
||||
// (including Mimir) where inhibition rules are supported.
|
||||
if len(config.AlertmanagerConfig.InhibitRules) > 0 {
|
||||
return errors.New("inhibition rules are not supported")
|
||||
}
|
||||
|
||||
// Get the last known working configuration
|
||||
_, err := moa.configStore.GetLatestAlertmanagerConfiguration(ctx, org)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user