From 561a538b183ff70e9794e4eeffc83527870fd7ba Mon Sep 17 00:00:00 2001 From: Georgy Lukyanov Date: Fri, 12 Jul 2024 07:33:32 +0200 Subject: [PATCH] Add `[request id]` context to relevant proxy log entries (#3975) Most `[proxy]` log entries are prefixed with `[request ID]`. The exception are are entries that are emitted in-between requests. Before: ``` [proxy] Starting RPC server [proxy] Processing request 0 [proxy] Starting execute request [request 0][booster][execute][depth] 0 steps. ... [proxy] Booster Aborted at Depth {getNat = 0} [proxy] Simplifying booster state and falling back to Kore [proxy] Simplifying execution state ... ``` After: ``` [proxy] Starting RPC server [proxy] Processing request 0 [request 0][proxy] Starting execute request [request 0][booster][execute][depth] 0 steps. ... [request 0][proxy] Booster Aborted at Depth {getNat = 0} [request 0][proxy] Simplifying booster state and falling back to Kore [request 0][proxy] Simplifying execution state ... ``` --- booster/tools/booster/Server.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/booster/tools/booster/Server.hs b/booster/tools/booster/Server.hs index 8d90fb504b..7c988d3a8f 100644 --- a/booster/tools/booster/Server.hs +++ b/booster/tools/booster/Server.hs @@ -319,9 +319,8 @@ main = do let koreRespond, boosterRespond :: JSONRPC.Id -> Respond (API 'Req) (Booster.Log.LoggerT IO) (API 'Res) koreRespond reqId = Kore.respond (fromId reqId) kore.serverState (ModuleName kore.mainModule) runSMT - boosterRespond reqId = - Booster.Log.withContextFor reqId - . Booster.Log.withContext CtxBooster + boosterRespond _reqId = + Booster.Log.withContext CtxBooster . Booster.respond boosterState proxyConfig = @@ -339,9 +338,10 @@ main = do srvSettings ( \rawReq req -> let reqId = getReqId rawReq - in runBoosterLogger $ + in runBoosterLogger $ do logRequestId reqId - >> Proxy.respondEither proxyConfig (boosterRespond reqId) (koreRespond reqId) req + Booster.Log.withContextFor reqId $ + Proxy.respondEither proxyConfig (boosterRespond reqId) (koreRespond reqId) req ) [ Kore.handleDecidePredicateUnknown , Booster.handleSmtError