Commit 32d6740b by Dominic Miglar Committed by Torkel Ödegaard

Alerting: Also include configured AlertRuleTags in Webhooks (#18233)

* added alert rule tags in webhook notifications

* fix: don't include whole list of Tag objects but only key/value pairs in Webhook JSON

* marked webhook alerts to support alert rule tags
parent e8790c32
......@@ -186,7 +186,7 @@ Slack | `slack` | yes | no
Telegram | `telegram` | yes | no
Threema | `threema` | yes, external only | no
VictorOps | `victorops` | yes, external only | no
Webhook | `webhook` | yes, external only | no
Webhook | `webhook` | yes, external only | yes
# Enable images in notifications {#external-image-store}
......
......@@ -81,6 +81,14 @@ func (wn *WebhookNotifier) Notify(evalContext *alerting.EvalContext) error {
bodyJSON.Set("state", evalContext.Rule.State)
bodyJSON.Set("evalMatches", evalContext.EvalMatches)
tags := make(map[string]string)
for _, tag := range evalContext.Rule.AlertRuleTags {
tags[tag.Key] = tag.Value
}
bodyJSON.Set("tags", tags)
ruleURL, err := evalContext.GetRuleURL()
if err == nil {
bodyJSON.Set("ruleUrl", ruleURL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment