alerting: improving and fixing alert history, #7257

This commit is contained in:
Torkel Ödegaard
2017-05-15 16:17:05 +02:00
parent f697f81950
commit f84dc24fcb
4 changed files with 27 additions and 15 deletions
+5 -7
View File
@@ -31,17 +31,15 @@ func (handler *DefaultResultHandler) Handle(evalContext *EvalContext) error {
executionError := ""
annotationData := simplejson.New()
if evalContext.Firing {
annotationData = simplejson.NewFromAny(evalContext.EvalMatches)
if len(evalContext.EvalMatches) > 0 {
annotationData.Set("evalMatches", simplejson.NewFromAny(evalContext.EvalMatches))
}
if evalContext.Error != nil {
executionError = evalContext.Error.Error()
annotationData.Set("errorMessage", executionError)
}
if evalContext.NoDataFound {
annotationData.Set("no_data", true)
annotationData.Set("error", executionError)
} else if evalContext.NoDataFound {
annotationData.Set("noData", true)
}
countStateResult(evalContext.Rule.State)