fix(alerting): minor fix

This commit is contained in:
Torkel Ödegaard
2016-07-19 09:28:49 +02:00
parent b0fe69822a
commit 0f555d6ab5
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ func (handler *ResultHandlerImpl) Handle(result *AlertResult) {
if handler.shouldUpdateState(result) {
cmd := &m.UpdateAlertStateCommand{
AlertId: result.AlertJob.Rule.Id,
NewState: result.State,
State: result.State,
Info: result.Description,
OrgId: result.AlertJob.Rule.OrgId,
TriggeredAlerts: simplejson.NewFromAny(result.TriggeredAlerts),
@@ -62,7 +62,7 @@ func (handler *ResultHandlerImpl) shouldUpdateState(result *AlertResult) bool {
lastExecution := query.Result.Created
asdf := result.StartTime.Add(time.Minute * -15)
olderThen15Min := lastExecution.Before(asdf)
changedState := query.Result.NewState != result.State
changedState := query.Result.State != result.State
return changedState || olderThen15Min
}
+2 -2
View File
@@ -47,13 +47,13 @@ func SetNewAlertState(cmd *m.UpdateAlertStateCommand) error {
return fmt.Errorf("Could not find alert")
}
alert.State = cmd.NewState
alert.State = cmd.State
sess.Id(alert.Id).Update(&alert)
alertState := m.AlertState{
AlertId: cmd.AlertId,
OrgId: cmd.OrgId,
NewState: cmd.NewState,
State: cmd.State,
Info: cmd.Info,
Created: time.Now(),
TriggeredAlerts: cmd.TriggeredAlerts,