update Evaluator interface to accept context (#52151)

This commit is contained in:
Yuriy Tseretyan
2022-07-13 10:21:11 -04:00
committed by GitHub
parent d71735d431
commit 0d4c503d3d
4 changed files with 13 additions and 11 deletions

View File

@@ -55,7 +55,7 @@ func (srv TestingApiSrv) RouteTestGrafanaRuleConfig(c *models.ReqContext, body a
now = timeNow()
}
evalResults := srv.evaluator.ConditionEval(evalCond, now)
evalResults := srv.evaluator.ConditionEval(c.Req.Context(), evalCond, now)
frame := evalResults.AsDataFrame()
return response.JSONStreaming(http.StatusOK, util.DynMap{
@@ -118,7 +118,7 @@ func (srv TestingApiSrv) RouteEvalQueries(c *models.ReqContext, cmd apimodels.Ev
return ErrResp(http.StatusBadRequest, err, "invalid queries or expressions")
}
evalResults, err := srv.evaluator.QueriesAndExpressionsEval(c.SignedInUser.OrgId, cmd.Data, now)
evalResults, err := srv.evaluator.QueriesAndExpressionsEval(c.Req.Context(), c.SignedInUser.OrgId, cmd.Data, now)
if err != nil {
return ErrResp(http.StatusBadRequest, err, "Failed to evaluate queries and expressions")
}