build message
This commit is contained in:
		
							parent
							
								
									8edcc901a9
								
							
						
					
					
						commit
						a57257af26
					
				| 
						 | 
				
			
			@ -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