freckle-app-1.15.5.0: Haskell application toolkit used at Freckle
Safe HaskellSafe-Inferred
LanguageHaskell2010

Freckle.App.Wai

Description

Integration of Freckle.App tooling with Network.Wai

Synopsis

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

corsMiddleware Source #

Arguments

:: (ByteString -> Bool)

Predicate that returns True for valid Origin values

-> [ByteString]

Extra headers to add to Expose-Headers

-> 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"
      }
    }
  }
}

Tracing

newOpenTelemetryWaiMiddleware :: IO Middleware Source #

Deprecated: Use OpenTelemetry.Instrumentation.Wai.newOpenTelemetryWaiMiddleware

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