mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Add resolved count to notification title when both firing and resolved present (#46697)
* Alerting: Add resolved count to notification title when both firing and resolved are present * Fix test case default_template_test.go
This commit is contained in:
parent
48113beeeb
commit
932f43b220
@ -12,7 +12,7 @@ import (
|
||||
const DefaultMessageTitleEmbed = `{{ template "default.title" . }}`
|
||||
|
||||
var DefaultTemplateString = `
|
||||
{{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}{{ end }}
|
||||
{{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ if gt (.Alerts.Resolved | len) 0 }}, RESOLVED:{{ .Alerts.Resolved | len }}{{ end }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}{{ end }}
|
||||
|
||||
{{ define "__text_alert_list" }}{{ range . }}
|
||||
Value: {{ or .ValueString "[no value]" }}
|
||||
|
@ -86,7 +86,7 @@ func TestDefaultTemplateString(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
templateString: DefaultMessageTitleEmbed,
|
||||
expected: `[FIRING:2] (alert1)`,
|
||||
expected: `[FIRING:2, RESOLVED:2] (alert1)`,
|
||||
},
|
||||
{
|
||||
templateString: `{{ template "default.message" .}}`,
|
||||
|
Loading…
Reference in New Issue
Block a user