Module
Distributed tracing middleware for Starlette-based applications. This middleware automatically extracts distributed tracing headers from incoming HTTP requests and makes them available to the Galileo logger within request handlers. Works with any ASGI framework built on Starlette:- FastAPI
- Starlette
- Any other Starlette-based framework
TracingMiddleware
Middleware that extracts distributed tracing headers from incoming requests. This middleware looks for the following headers in incoming HTTP requests:- X-Galileo-Trace-ID: The root trace ID
- X-Galileo-Parent-ID: The parent span/trace ID to attach to
get_request_logger() function.
The middleware is compatible with FastAPI and any Starlette-based framework.
Note: Project and log_stream are configured per service via environment variables
(GALILEO_PROJECT and GALILEO_LOG_STREAM). They are not propagated via headers,
following standard distributed tracing patterns.
dispatch
request(Request): The incoming HTTP requestcall_next(RequestResponseEndpoint): The next middleware or route handler
Response: The HTTP response
get_request_logger
- X-Galileo-Trace-ID: Root trace ID
- X-Galileo-Parent-ID: Parent span/trace ID to attach to
GalileoLogger: A logger instance configured for the current request’s trace context