Alerting: Extract values from MD expr alerts (#34757) (#34908)

When using mulit-dimensional Grafana managed alerts (e.g. SSE math) extract refIds values and labels so they can be shown in the notification and dashboards.

(cherry picked from commit b47e7d12e6)

Co-authored-by: Kyle Brandt <kyle@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2021-05-28 11:34:59 -04:00
committed by GitHub
co-authored by Kyle Brandt
parent 0101d3a51d
commit 4c967fe718
4 changed files with 100 additions and 23 deletions
@@ -1613,7 +1613,7 @@ func TestEval(t *testing.T) {
"Alerting"
],
[
""
"[ var='A' labels={} value=1 ]"
]
]
}
@@ -1674,7 +1674,7 @@ func TestEval(t *testing.T) {
"Normal"
],
[
""
"[ var='A' labels={} value=0 ]"
]
]
}
@@ -1454,7 +1454,7 @@ var expNotifications = map[string][]string{
"startsAt": "%s",
"endsAt": "0001-01-01T00:00:00Z",
"generatorURL": "",
"fingerprint": "929467973978d053",
"fingerprint": "7611eef9e67f6e50",
"silenceURL": "http://localhost:3000/alerting/silence/new?alertmanager=grafana&matchers=alertname%%3DWebhookAlert",
"dashboardURL": "",
"panelURL": ""
@@ -1618,6 +1618,7 @@ var expNotifications = map[string][]string{
{
"labels": {
"__alert_rule_uid__": "UID_AlertmanagerAlert",
"__value__": "[ var='A' labels={} value=1 ]",
"alertname": "AlertmanagerAlert"
},
"annotations": {},