module Instana.Wai.Middleware.Entry.Internal
( traceHttpEntries
) where
import Network.Wai (Middleware)
import Instana.SDK.SDK (InstanaContext, postProcessHttpResponse,
withHttpEntry_)
traceHttpEntries :: InstanaContext -> Middleware
traceHttpEntries :: InstanaContext -> Middleware
traceHttpEntries instana :: InstanaContext
instana app :: Application
app request :: Request
request respond :: Response -> IO ResponseReceived
respond = do
InstanaContext
-> Request -> IO ResponseReceived -> IO ResponseReceived
forall (m :: * -> *) a.
MonadIO m =>
InstanaContext -> Request -> m a -> m a
withHttpEntry_ InstanaContext
instana Request
request (IO ResponseReceived -> IO ResponseReceived)
-> IO ResponseReceived -> IO ResponseReceived
forall a b. (a -> b) -> a -> b
$ do
Application
app Request
request ((Response -> IO ResponseReceived) -> IO ResponseReceived)
-> (Response -> IO ResponseReceived) -> IO ResponseReceived
forall a b. (a -> b) -> a -> b
$ \response :: Response
response -> do
Response
response' <- InstanaContext -> Response -> IO Response
forall (m :: * -> *).
MonadIO m =>
InstanaContext -> Response -> m Response
postProcessHttpResponse InstanaContext
instana Response
response
Response -> IO ResponseReceived
respond (Response -> IO ResponseReceived)
-> Response -> IO ResponseReceived
forall a b. (a -> b) -> a -> b
$ Response
response'