Alerting: Send merged configuration to the remote alertmanager (#107004)

This commit is contained in:
Alexander Akhmetov
2025-07-02 21:35:24 +02:00
committed by GitHub
parent d57155a19b
commit b483a04aec
9 changed files with 621 additions and 27 deletions
@@ -1051,21 +1051,9 @@ func (c *GettableApiAlertingConfig) UnmarshalYAML(value *yaml.Node) error {
func (c *GettableApiAlertingConfig) validate() error {
receivers := make(map[string]struct{}, len(c.Receivers))
var hasGrafReceivers, hasAMReceivers bool
for _, r := range c.Receivers {
receivers[r.Name] = struct{}{}
switch r.Type() {
case GrafanaReceiverType:
hasGrafReceivers = true
case AlertmanagerReceiverType:
hasAMReceivers = true
default:
continue
}
}
if hasGrafReceivers && hasAMReceivers {
return fmt.Errorf("cannot mix Alertmanager & Grafana receiver types")
// Populate the receivers map with defined receiver names
for _, receiver := range c.Receivers {
receivers[receiver.Name] = struct{}{}
}
for _, receiver := range AllReceivers(c.Route.AsAMRoute()) {