diff --git a/notifier/notifier.go b/notifier/notifier.go index 82c489a2e..d1832402f 100644 --- a/notifier/notifier.go +++ b/notifier/notifier.go @@ -539,9 +539,9 @@ func (n *Manager) sendAll(alerts ...*Alert) bool { ctx, cancel := context.WithTimeout(n.ctx, time.Duration(ams.cfg.Timeout)) defer cancel() - go func(client *http.Client, url string) { + go func(ctx context.Context, client *http.Client, url string, payload []byte, count int) { if err := n.sendOne(ctx, client, url, payload); err != nil { - level.Error(n.logger).Log("alertmanager", url, "count", len(amAlerts), "msg", "Error sending alert", "err", err) + level.Error(n.logger).Log("alertmanager", url, "count", count, "msg", "Error sending alert", "err", err) n.metrics.errors.WithLabelValues(url).Inc() } else { numSuccess.Inc() @@ -550,7 +550,7 @@ func (n *Manager) sendAll(alerts ...*Alert) bool { n.metrics.sent.WithLabelValues(url).Add(float64(len(amAlerts))) wg.Done() - }(ams.client, am.url().String()) + }(ctx, ams.client, am.url().String(), payload, len(amAlerts)) } ams.mtx.RUnlock()