tech(alerting): set prev state when creating eval context

This commit is contained in:
bergquist
2016-11-07 13:01:54 +01:00
parent 489f087fbd
commit d7f11c304c
2 changed files with 7 additions and 8 deletions

View File

@@ -33,12 +33,13 @@ type EvalContext struct {
func NewEvalContext(alertCtx context.Context, rule *Rule) *EvalContext {
return &EvalContext{
Ctx: alertCtx,
StartTime: time.Now(),
Rule: rule,
Logs: make([]*ResultLogEntry, 0),
EvalMatches: make([]*EvalMatch, 0),
log: log.New("alerting.evalContext"),
Ctx: alertCtx,
StartTime: time.Now(),
Rule: rule,
Logs: make([]*ResultLogEntry, 0),
EvalMatches: make([]*EvalMatch, 0),
log: log.New("alerting.evalContext"),
PrevAlertState: rule.State,
}
}

View File

@@ -59,8 +59,6 @@ func (handler *DefaultResultHandler) GetStateFromEvaluation(evalContext *EvalCon
}
func (handler *DefaultResultHandler) Handle(evalContext *EvalContext) error {
evalContext.PrevAlertState = evalContext.Rule.State
executionError := ""
annotationData := simplejson.New()