PagerDuty: Fix custom_details to be a JSON object instead of a string (#21150)

This commit is contained in:
Christoph 2019-12-18 10:42:25 +01:00 committed by Sofia Papagiannaki
parent e9079c3faa
commit 8c089b98b3

View File

@ -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)