Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Freckle.App.Wai
Description
Integration of Freckle.App tooling with Network.Wai
Synopsis
- noCacheMiddleware :: Middleware
- denyFrameEmbeddingMiddleware :: Middleware
- corsMiddleware :: (ByteString -> Bool) -> [ByteString] -> Middleware
- requestLogger :: HasLogger env => env -> Middleware
- addThreadContextFromRequest :: (Request -> [Pair]) -> Middleware
- newOpenTelemetryWaiMiddleware :: HasCallStack => IO Middleware
- addThreadContextFromTracing :: Middleware
- addThreadContextFromStatsTags :: HasStatsClient env => env -> Middleware
- requestStats :: HasStatsClient env => env -> (Request -> [(Text, Text)]) -> Middleware
Documentation
noCacheMiddleware :: Middleware Source #
Middleware that adds header to disable all caching
denyFrameEmbeddingMiddleware :: Middleware Source #
Middleware that adds header to deny all frame embedding
CORS
Arguments
:: (ByteString -> Bool) | Predicate that returns |
-> [ByteString] | Extra headers to add to |
-> Middleware |
Logs
requestLogger :: HasLogger env => env -> Middleware #
Log requests (more accurately, responses) as they happen
In JSON format, logged messages look like:
{ ... message: { text: "GET foobar => 200 OK", meta: { method: GET, path: "foobar", query: "?baz=bat&quix=quo", status: { code: 200, message: OK }, durationMs: 1322.2, requestHeaders: { Authorization: "***", Accept: "text/html", Cookie: "***" }, responseHeaders: { Set-Cookie: "***", Expires: "never" } } } }
addThreadContextFromRequest :: (Request -> [Pair]) -> Middleware #
addThreadContext
, but have the Request
available
Tracing
addThreadContextFromTracing :: Middleware Source #
Middleware that adds trace context to logging context
Metrics
addThreadContextFromStatsTags :: HasStatsClient env => env -> Middleware Source #
Add any tags in the ambient StatsClient
to the logging context
requestStats :: HasStatsClient env => env -> (Request -> [(Text, Text)]) -> Middleware Source #
Emit requests
and response_time_ms
metrics