From 83cda784d2fb16278d1cb8622d1e976daec3b83e Mon Sep 17 00:00:00 2001 From: johncming Date: Wed, 11 Dec 2019 18:03:50 +0800 Subject: [PATCH] skip empty alerts. (#6444) Signed-off-by: johncming --- notifier/notifier.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notifier/notifier.go b/notifier/notifier.go index 640ce4c59d..300dc781fe 100644 --- a/notifier/notifier.go +++ b/notifier/notifier.go @@ -457,6 +457,10 @@ func (n *Manager) DroppedAlertmanagers() []*url.URL { // sendAll sends the alerts to all configured Alertmanagers concurrently. // It returns true if the alerts could be sent successfully to at least one Alertmanager. func (n *Manager) sendAll(alerts ...*Alert) bool { + if len(alerts) == 0 { + return true + } + begin := time.Now() // v1Payload and v2Payload represent 'alerts' marshaled for Alertmanager API