{{/* Template enhanced to include resolved alerts while using annotations. */}}
{{ $firingCount := len .Alerts.Firing -}}
{{ $resolvedCount := len .Alerts.Resolved -}}
{{ if or (gt $firingCount 0) (gt $resolvedCount 0) -}}
{{ if and (gt $firingCount 0) (gt $resolvedCount 0) -}}
{{ $firingCount }} firing / {{ $resolvedCount }} resolved
{{ if gt $firingCount 0 -}}
Firing:
{{- range .Alerts.Firing }}
• {{ or .Annotations.summary "No summary" }}{{ with .Annotations.description }} — {{ . }}{{ end }}
{{- end }}
{{ end -}}
{{ if gt $resolvedCount 0 -}}
Resolved:
{{- range .Alerts.Resolved }}
• {{ or .Annotations.summary "No summary" }}{{ with .Annotations.description }} — {{ . }}{{ end }}
{{- end }}
{{ end -}}
{{ else if gt $firingCount 0 -}}
{{ $firingCount }} alert{{ if ne $firingCount 1 }}s{{ end }} firing:
{{- range .Alerts.Firing }}
• {{ or .Annotations.summary "No summary" }}{{ with .Annotations.description }} — {{ . }}{{ end }}
{{- end }}
{{ else -}}
{{ $resolvedCount }} alert{{ if ne $resolvedCount 1 }}s{{ end }} resolved:
{{- range .Alerts.Resolved }}
• {{ or .Annotations.summary "No summary" }}{{ with .Annotations.description }} — {{ . }}{{ end }}
{{- end }}
{{ end -}}
{{ else -}}
No alert data — nothing firing or recently resolved.
{{ end -}}