fix(alerting): fixes bug that prevents noData from triggering

closes #6631
This commit is contained in:
bergquist
2016-11-22 11:47:52 +01:00
parent d73620f304
commit 50811c80ea
2 changed files with 42 additions and 1 deletions
+4
View File
@@ -23,6 +23,7 @@ func NewEvalHandler() *DefaultEvalHandler {
func (e *DefaultEvalHandler) Eval(context *EvalContext) {
firing := true
noDataFound := true
conditionEvals := ""
for i := 0; i < len(context.Rule.Conditions); i++ {
@@ -40,8 +41,10 @@ func (e *DefaultEvalHandler) Eval(context *EvalContext) {
// calculating Firing based on operator
if cr.Operator == "or" {
firing = firing || cr.Firing
noDataFound = noDataFound || cr.NoDataFound
} else {
firing = firing && cr.Firing
noDataFound = noDataFound && cr.NoDataFound
}
if i > 0 {
@@ -55,6 +58,7 @@ func (e *DefaultEvalHandler) Eval(context *EvalContext) {
context.ConditionEvals = conditionEvals + " = " + strconv.FormatBool(firing)
context.Firing = firing
context.NoDataFound = noDataFound
context.EndTime = time.Now()
elapsedTime := context.EndTime.Sub(context.StartTime) / time.Millisecond
metrics.M_Alerting_Exeuction_Time.Update(elapsedTime)