tower_http::trace::TraceLayer.on_eos can not be called #2453
-
Bug ReportVersion
PlatformWindows x64 DescriptionI want to measure the whole time of http server processing (including network IO), so I try to use TraceLayer to log the time like following code: let app = Router::new()
.route("/api", post(api))
.layer(TraceLayer::new_for_http().on_eos(|trailers: Option<&HeaderMap>, stream_duration: Duration, _span: &Span| {
println!("stream closed after {:?}", stream_duration)
})) But I can not see anying on console, please help. Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
davidpdrsn
Dec 28, 2023
Replies: 1 comment
-
That's not what |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kobe2000
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's not what
on_eos
is intended for. In order to get accurate measurements, including IO, you'll have to use hyper. I'm not sure which APIs hyper has to measure this kinda of stuff but try asking in hyper's discord channel.