Alerting: Fix panics when attempting to create an Alertmanager after failing (#94023)

This commit is contained in:
Santiago
2024-09-30 13:50:35 -03:00
committed by GitHub
parent 80611b381c
commit aa77023008
18 changed files with 89 additions and 85 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ func NewAlertmanagerMetrics(r prometheus.Registerer, l log.Logger) *Alertmanager
other := prometheus.WrapRegistererWithPrefix(fmt.Sprintf("%s_%s_", Namespace, Subsystem), r)
return &Alertmanager{
Registerer: r,
Alerts: metrics.NewAlerts(other),
Alerts: metrics.NewAlerts(other, l),
AlertmanagerConfigMetrics: NewAlertmanagerConfigMetrics(r, l),
}
}
@@ -135,7 +135,7 @@ func NewAlertmanager(ctx context.Context, orgID int64, cfg *setting.Cfg, store A
}
l := log.New("ngalert.notifier.alertmanager", "org", orgID)
gam, err := alertingNotify.NewGrafanaAlertmanager("orgID", orgID, amcfg, peer, l, alertingNotify.NewGrafanaAlertmanagerMetrics(m.Registerer))
gam, err := alertingNotify.NewGrafanaAlertmanager("orgID", orgID, amcfg, peer, l, alertingNotify.NewGrafanaAlertmanagerMetrics(m.Registerer, l))
if err != nil {
return nil, err
}