Commit 4e1f801f by bergquist

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

parent 76758d27
......@@ -122,5 +122,6 @@ type AlertResult struct {
State string
ActualValue float64
Duration float64
Description string
Rule AlertRule
}
......@@ -3,7 +3,6 @@ package alerting
import (
"time"
"fmt"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/log"
m "github.com/grafana/grafana/pkg/models"
......@@ -103,12 +102,7 @@ func (this *Scheduler) HandleResponses() {
cmd := m.UpdateAlertStateCommand{
AlertId: response.Id,
NewState: response.State,
}
if cmd.NewState != m.AlertStateOk {
cmd.Info = fmt.Sprintf("Actual value: %1.2f", response.ActualValue)
} else {
cmd.Info = "Alert is OK!"
Info: response.Description,
}
if err := bus.Dispatch(&cmd); err != nil {
......
......@@ -102,6 +102,7 @@ func (this *ExecutorImpl) ValidateRule(rule m.AlertRule, series m.TimeSeriesSlic
State: m.AlertStateCritical,
Id: rule.Id,
ActualValue: aggValue,
Description: fmt.Sprintf("Actual value: %1.2f for %s", aggValue, serie.Name),
Rule: rule,
}
}
......@@ -110,11 +111,12 @@ func (this *ExecutorImpl) ValidateRule(rule m.AlertRule, series m.TimeSeriesSlic
return &m.AlertResult{
State: m.AlertStateWarn,
Id: rule.Id,
Description: fmt.Sprintf("Actual value: %1.2f for %s", aggValue, serie.Name),
ActualValue: aggValue,
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