server: Fix trace span names for queries and mutations (#5668)

This commit is contained in:
Phil Freeman 2020-08-27 19:47:05 -07:00 committed by GitHub
parent db3492f50b
commit d210a0df2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,7 +204,7 @@ runQueryDB reqId (query, queryParsed) asts _userInfo (tx, genSql) = do
-- log the generated SQL and the graphql query
E.ExecutionCtx logger _ pgExecCtx _ _ _ _ <- ask
logQueryLog logger query (Just genSql) reqId
(telemTimeIO, respE) <- withElapsedTime $ runExceptT $ trace "pg" $
(telemTimeIO, respE) <- withElapsedTime $ runExceptT $ trace "Query" $
Tracing.interpTraceT id $ executeQuery queryParsed asts (Just genSql) pgExecCtx Q.ReadOnly tx
(respHdrs,resp) <- liftEither respE
let !json = encodeGQResp $ GQSuccess $ encJToLBS resp
@ -230,7 +230,7 @@ runMutationDB reqId query userInfo tx = do
-- log the graphql query
logQueryLog logger query Nothing reqId
ctx <- Tracing.currentContext
(telemTimeIO, respE) <- withElapsedTime $ runExceptT $ trace "pg" $
(telemTimeIO, respE) <- withElapsedTime $ runExceptT $ trace "Mutation" $
Tracing.interpTraceT (runLazyTx pgExecCtx Q.ReadWrite . withTraceContext ctx . withUserInfo userInfo) tx
resp <- liftEither respE
let !json = encodeGQResp $ GQSuccess $ encJToLBS resp