build message
This commit is contained in:
		
							parent
							
								
									8edcc901a9
								
							
						
					
					
						commit
						a57257af26
					
				| 
						 | 
					@ -29,12 +29,17 @@ func init() {
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			content := ""
 | 
								content := strings.Join(request.GroupLabels.Values(), " ")
 | 
				
			||||||
			firingAlerts := len(request.Alerts.Firing())
 | 
								firingAlerts := request.Alerts.Firing()
 | 
				
			||||||
			if firingAlerts > 0 {
 | 
								if len(firingAlerts) > 0 {
 | 
				
			||||||
				content = fmt.Sprintf("[%s:%d] %s", request.Status, firingAlerts, strings.Join(request.CommonAnnotations.Values(), " "))
 | 
									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 {
 | 
								} 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)
 | 
								logger = logger.WithField("body", content)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue