Commit 4e1f801f by bergquist

feat(alerting): add serie name to failed alert description

parent 76758d27
...@@ -122,5 +122,6 @@ type AlertResult struct { ...@@ -122,5 +122,6 @@ type AlertResult struct {
State string State string
ActualValue float64 ActualValue float64
Duration float64 Duration float64
Description string
Rule AlertRule Rule AlertRule
} }
...@@ -3,7 +3,6 @@ package alerting ...@@ -3,7 +3,6 @@ package alerting
import ( import (
"time" "time"
"fmt"
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/log"
m "github.com/grafana/grafana/pkg/models" m "github.com/grafana/grafana/pkg/models"
...@@ -103,12 +102,7 @@ func (this *Scheduler) HandleResponses() { ...@@ -103,12 +102,7 @@ func (this *Scheduler) HandleResponses() {
cmd := m.UpdateAlertStateCommand{ cmd := m.UpdateAlertStateCommand{
AlertId: response.Id, AlertId: response.Id,
NewState: response.State, NewState: response.State,
} Info: response.Description,
if cmd.NewState != m.AlertStateOk {
cmd.Info = fmt.Sprintf("Actual value: %1.2f", response.ActualValue)
} else {
cmd.Info = "Alert is OK!"
} }
if err := bus.Dispatch(&cmd); err != nil { if err := bus.Dispatch(&cmd); err != nil {
......
...@@ -102,6 +102,7 @@ func (this *ExecutorImpl) ValidateRule(rule m.AlertRule, series m.TimeSeriesSlic ...@@ -102,6 +102,7 @@ func (this *ExecutorImpl) ValidateRule(rule m.AlertRule, series m.TimeSeriesSlic
State: m.AlertStateCritical, State: m.AlertStateCritical,
Id: rule.Id, Id: rule.Id,
ActualValue: aggValue, ActualValue: aggValue,
Description: fmt.Sprintf("Actual value: %1.2f for %s", aggValue, serie.Name),
Rule: rule, Rule: rule,
} }
} }
...@@ -110,11 +111,12 @@ func (this *ExecutorImpl) ValidateRule(rule m.AlertRule, series m.TimeSeriesSlic ...@@ -110,11 +111,12 @@ func (this *ExecutorImpl) ValidateRule(rule m.AlertRule, series m.TimeSeriesSlic
return &m.AlertResult{ return &m.AlertResult{
State: m.AlertStateWarn, State: m.AlertStateWarn,
Id: rule.Id, Id: rule.Id,
Description: fmt.Sprintf("Actual value: %1.2f for %s", aggValue, serie.Name),
ActualValue: aggValue, ActualValue: aggValue,
Rule: rule, Rule: rule,
} }
} }
} }
return &m.AlertResult{State: m.AlertStateOk, Id: rule.Id, Rule: rule} return &m.AlertResult{State: m.AlertStateOk, Id: rule.Id, Rule: rule, Description: "Alert is OK!"}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment