diff --git a/prometheus/main.go b/prometheus/main.go index 77ce15b..8df1df4 100644 --- a/prometheus/main.go +++ b/prometheus/main.go @@ -30,17 +30,19 @@ func init() { return } - contentTag := request.Status - if len(request.Alerts.Firing()) > 0 { - contentTag += ":" + len(request.Alerts.Firing()) + firingAlerts := len(request.Alerts.Firing()) + if firingAlerts > 0 { + content := fmt.Sprintf("[%s:%d] %s", request.Status, firingAlerts, strings.Join(request.CommonAnnotations.Values()," ")) + } else { + content := fmt.Sprintf("[%s] %s", request.Status, strings.Join(request.CommonAnnotations.Values()," ")) } - content := fmt.Sprintf("[%s] %s", contentTag, strings.Join(request.CommonAnnotations.Values()," ")) + logger = logger.WithField("body", content) ok := false for _, hook := range hooks { - if request.Payload.VCSURL != hook.Secret { + if request.ExternalURL != hook.Secret { continue } logger.Infof("run hook")