LukeMathWalker/tracing-actix-web

Interest in waiting until after body stream completes to close span?

asonix opened this issue · 1 comments

I noticed that this middleware closes it's span at the end of it's middleware scope, rather than after the body stream has finished writing and the connection closed when I started serving files off disk. Looking into the actix-web Logger's implementation, it seems it gets around this problem by wrapping the Response in a custom LoggerResponse type, which doesn't produce any console output until it's dropped. https://github.com/actix/actix-web/blob/a3806cde190ec27703576a91b470a6c8706cd5b1/src/middleware/logger.rs#L226

Would there be any interest in bringing this kind of feature into tracing-actix-web, or is there a reason for the current behavior?

Would there be any interest in bringing this kind of feature into tracing-actix-web, or is there a reason for the current behavior?

It would definitely be a good addition!