fix: Update PagerDuty API V2 to send full details on resolve (#1483)

This adds compatiblity with PagerDuty's Event rules feature, allowing resolve events to be routed based on attributes

Fixes #1440

Signed-off-by: Mike Bryant <m@ocado.com>
This commit is contained in:
Mike Bryant 2018-08-01 14:57:15 +01:00 committed by Max Leonard Inden
parent 2866d5c192
commit 579acdc9e2
No known key found for this signature in database
GPG Key ID: 5403C5464810BC26
1 changed files with 8 additions and 16 deletions

View File

@ -521,9 +521,13 @@ func (n *PagerDuty) notifyV2(
n.conf.Severity = "error"
}
var payload *pagerDutyPayload
if eventType == pagerDutyEventTrigger {
payload = &pagerDutyPayload{
msg := &pagerDutyMessage{
Client: tmpl(n.conf.Client),
ClientURL: tmpl(n.conf.ClientURL),
RoutingKey: tmpl(string(n.conf.RoutingKey)),
EventAction: eventType,
DedupKey: hashKey(key),
Payload: &pagerDutyPayload{
Summary: tmpl(n.conf.Description),
Source: tmpl(n.conf.Client),
Severity: tmpl(n.conf.Severity),
@ -531,19 +535,7 @@ func (n *PagerDuty) notifyV2(
Class: tmpl(n.conf.Class),
Component: tmpl(n.conf.Component),
Group: tmpl(n.conf.Group),
}
}
msg := &pagerDutyMessage{
RoutingKey: tmpl(string(n.conf.RoutingKey)),
EventAction: eventType,
DedupKey: hashKey(key),
Payload: payload,
}
if eventType == pagerDutyEventTrigger {
msg.Client = tmpl(n.conf.Client)
msg.ClientURL = tmpl(n.conf.ClientURL)
},
}
if tmplErr != nil {