build message
This commit is contained in:
parent
037af4a638
commit
10325aa7a8
|
@ -29,12 +29,17 @@ func init() {
|
|||
return
|
||||
}
|
||||
|
||||
content := ""
|
||||
firingAlerts := len(request.Alerts.Firing())
|
||||
if firingAlerts > 0 {
|
||||
content = fmt.Sprintf("[%s:%d] %s", request.Status, firingAlerts, strings.Join(request.CommonAnnotations.Values(), " "))
|
||||
content := strings.Join(request.GroupLabels.Values(), " ")
|
||||
firingAlerts := request.Alerts.Firing()
|
||||
if len(firingAlerts) > 0 {
|
||||
for _, a := range firingAlerts {
|
||||
if description, ok := a.Annotations["description"]; ok {
|
||||
content = fmt.Sprintf("%s\n%s", content, description)
|
||||
}
|
||||
}
|
||||
content = fmt.Sprintf("[%s:%d] %s", request.Status, len(firingAlerts), content)
|
||||
} else {
|
||||
content = fmt.Sprintf("[%s] %s", request.Status, strings.Join(request.CommonAnnotations.Values(), " "))
|
||||
content = fmt.Sprintf("[%s] %s", request.Status, content)
|
||||
}
|
||||
|
||||
logger = logger.WithField("body", content)
|
||||
|
|
Loading…
Reference in New Issue