|
|
|
|
@ -30,7 +30,7 @@ import ( |
|
|
|
|
"github.com/prometheus/prometheus/notification" |
|
|
|
|
"github.com/prometheus/prometheus/promql" |
|
|
|
|
"github.com/prometheus/prometheus/storage" |
|
|
|
|
"github.com/prometheus/prometheus/templates" |
|
|
|
|
"github.com/prometheus/prometheus/template" |
|
|
|
|
"github.com/prometheus/prometheus/utility" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
@ -195,8 +195,8 @@ func (m *Manager) queueAlertNotifications(rule *AlertingRule, timestamp clientmo |
|
|
|
|
defs := "{{$labels := .Labels}}{{$value := .Value}}" |
|
|
|
|
|
|
|
|
|
expand := func(text string) string { |
|
|
|
|
template := templates.NewTemplateExpander(defs+text, "__alert_"+rule.Name(), tmplData, timestamp, m.queryEngine, m.pathPrefix) |
|
|
|
|
result, err := template.Expand() |
|
|
|
|
tmpl := template.NewTemplateExpander(defs+text, "__alert_"+rule.Name(), tmplData, timestamp, m.queryEngine, m.pathPrefix) |
|
|
|
|
result, err := tmpl.Expand() |
|
|
|
|
if err != nil { |
|
|
|
|
result = err.Error() |
|
|
|
|
log.Warnf("Error expanding alert template %v with data '%v': %v", rule.Name(), tmplData, err) |
|
|
|
|
|