Alerting: Refactor Evaluator (#51673)
* AlertRule to return condition * update ConditionEval to not return an error because it's always nil * make getExprRequest private * refactor executeCondition to just converter and move execution to the ConditionEval as this makes code more readable. * log error if results have errors * change signature of evaluate function to not return an error
This commit is contained in:
@@ -55,10 +55,7 @@ func (srv TestingApiSrv) RouteTestGrafanaRuleConfig(c *models.ReqContext, body a
|
||||
now = timeNow()
|
||||
}
|
||||
|
||||
evalResults, err := srv.evaluator.ConditionEval(&evalCond, now)
|
||||
if err != nil {
|
||||
return ErrResp(http.StatusBadRequest, err, "Failed to evaluate conditions")
|
||||
}
|
||||
evalResults := srv.evaluator.ConditionEval(evalCond, now)
|
||||
|
||||
frame := evalResults.AsDataFrame()
|
||||
return response.JSONStreaming(http.StatusOK, util.DynMap{
|
||||
|
||||
Reference in New Issue
Block a user