From 8c089b98b38ba839b3e29861337166c868928d04 Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 18 Dec 2019 10:42:25 +0100 Subject: [PATCH] PagerDuty: Fix custom_details to be a JSON object instead of a string (#21150) --- pkg/services/alerting/notifiers/pagerduty.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/services/alerting/notifiers/pagerduty.go b/pkg/services/alerting/notifiers/pagerduty.go index c3bcf475c46..9fe27f67b4c 100644 --- a/pkg/services/alerting/notifiers/pagerduty.go +++ b/pkg/services/alerting/notifiers/pagerduty.go @@ -5,8 +5,6 @@ import ( "strconv" "time" - "fmt" - "github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/infra/log" @@ -80,9 +78,9 @@ func (pn *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error { if evalContext.Rule.State == models.AlertStateOK { eventType = "resolve" } - customData := triggMetrString + customData := simplejson.New() for _, evt := range evalContext.EvalMatches { - customData = customData + fmt.Sprintf("%s: %v\n", evt.Metric, evt.Value) + customData.Set(evt.Metric, evt.Value) } pn.log.Info("Notifying Pagerduty", "event_type", eventType)