mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PagerDuty: Fix custom_details to be a JSON object instead of a string (#21150)
This commit is contained in:
parent
e9079c3faa
commit
8c089b98b3
@ -5,8 +5,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/bus"
|
"github.com/grafana/grafana/pkg/bus"
|
||||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||||
"github.com/grafana/grafana/pkg/infra/log"
|
"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 {
|
if evalContext.Rule.State == models.AlertStateOK {
|
||||||
eventType = "resolve"
|
eventType = "resolve"
|
||||||
}
|
}
|
||||||
customData := triggMetrString
|
customData := simplejson.New()
|
||||||
for _, evt := range evalContext.EvalMatches {
|
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)
|
pn.log.Info("Notifying Pagerduty", "event_type", eventType)
|
||||||
|
Loading…
Reference in New Issue
Block a user