eventuo11y-batteries-0.4.0.1: Grab bag of eventuo11y-enriched functionality
CopyrightCopyright 2022 Shea Levy.
LicenseApache-2.0
Maintainershea@shealevy.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Observe.Event.Wai

Description

 
Synopsis

Application

type Application em r s = Request -> (Response -> em r s ResponseReceived) -> em r s ResponseReceived Source #

An instrumented Application

application :: (MonadUnliftIO (em r s), MonadWithEvent em) => InjectSelector ServeRequest s -> Application em r s -> em r s Application Source #

Run an Application with generic Request/Response instrumentation.

Instrumentation

data ServeRequest f where Source #

Event selector for application.

renderServeRequest :: RenderSelectorJSON ServeRequest Source #

Render a ServeRequest, and any Events selected by it, to JSON

setOnException

type OnExceptionCallback em r s = Maybe Request -> SomeException -> em r s () Source #

An instrumented setOnException callback.

onExceptionCallback :: (MonadUnliftIO (em r s), MonadWithEvent em) => InjectSelector OnException s -> OnExceptionCallback em r s -> em r s (Maybe Request -> SomeException -> IO ()) Source #

Convert an OnExceptionCallback to a setOnException callback.

The OnExceptionCallback is called as the child of an Event rendering the exception, if it's one that should be displayed according to defaultShouldDisplayException.

Ideally this would have a way to get a parent Event from application. Would be nice to use vault, but there doesn't seem to be a way to get at the Request that Warp will pass here.

Instrumentation

data OnException f where Source #

Selector for onException

renderOnException :: Exception stex => RenderExJSON stex -> RenderSelectorJSON OnException Source #

Render an OnException, and its selected-for Events, as JSON, with a provided base structured exception type.

renderOnExceptionField :: Exception stex => RenderExJSON stex -> RenderFieldJSON OnExceptionField Source #

Render an OnExceptionField as JSON, with a provided base structured exception type.

Miscellaneous instrumentation

renderRequest :: Request -> Value Source #

Render a Request to JSON.