Summary of problem
It seems middlewares are not traced in fastapi.
Moreover, trying to use tracer.get_log_correlation_context() within a middleware will not return any active context, which means we can't operate with traceId (e.g to enrich response/logs within a middleware).
https://fastapi.tiangolo.com/tutorial/middleware/
Which version of dd-trace-py are you using?
1.5.2