Module neos_common.middleware.timing
====================================
Based on https://github.com/dmontagu/fastapi-utils.

Which is based on https://github.com/steinnes/timing-asgi.git

Bringing in house to support pydantic v2 and fastapi-utils has not been updated in 4 months at 07/2023.

The middleware from this module is intended for use during both development and production,
but only reports timing data at the granularity of individual endpoint calls.

For more detailed performance investigations (during development only, due to added overhead),
consider using the coroutine-aware profiling library `yappi`.

Functions
---------

`add_timing_middleware(app: FastAPI, record: Callable[[str], None] | None = None, prefix: str = '', exclude: str | None = None)`
:   Adds a middleware to the provided `app` that records timing metrics using the provided `record` callable.
    
    Typically `record` would be something like `logger.info` for a `logging.Logger` instance.
    
    The provided `prefix` is used when generating route names.
    
    If `exclude` is provided, timings for any routes containing `exclude`
    as an exact substring of the generated metric name will not be logged.
    This provides an easy way to disable logging for routes
    
    The `exclude` will probably be replaced by a regex match at some point in the future. (PR welcome!)

`get_trace_id(request: Request)`
:   

`record_timing(request: Request, note: str | None = None)`
:   Call this function at any point that you want to display elapsed time during the handling of a single request.
    
    This can help profile which piece of a request is causing a performance bottleneck.
    
    Note that for this function to succeed, the request should have been generated by a FastAPI app
    that has had timing middleware added using the `fastapi_utils.timing.add_timing_middleware` function.