Constrain type parameter of `RootSpanBuilder::on_request_end` with `actix_web::body::MessageBody`
rharish101 opened this issue · 3 comments
rharish101 commented
Is it possible to change the API to change the following in RootSpanBuilder
:
fn on_request_end<B>(span: Span, outcome: &Result<ServiceResponse<B>, Error>);
to the following?:
fn on_request_end<B: MessageBody>(span: Span, outcome: &Result<ServiceResponse<B>, Error>);
This will allow using methods defined for MessageBody when creating custom RootSpanBuilder
s, such as MessageBody::size
. The root span is always called on MessageBody
s anyway, as seen here:
tracing-actix-web/src/middleware.rs
Lines 181 to 198 in c95a781
I can create a PR if this is fine.
LukeMathWalker commented
Yes, a PR would be welcome!
rharish101 commented
I've created PR #93 to solve this.
LukeMathWalker commented
Merged and released as 0.7.0 - thanks!