1 day ago · 7 min read1305 words · Tech · hide · 0 comments

Recently, I wrote about using Go's net/http/httptrace to get the per-phase timing breakdown for HTTP requests - DNS, TCP, TLS, and server processing. After writing about that package, I wanted to know what the same breakdown costs in Rust: whether the ecosystem has an equivalent, and what building one reveals about how the two languages approach instrumentation. The short answer is there's no equivalent. reqwest doesn't expose per-phase timestamps. hyper's client is a Tower Service, not a single blessed HTTP client with hook points. Getting DNS/TCP/TLS granularity means working at the connector level directly. So I built httptrace, a small crate that does for Rust what net/http/httptrace does for Go, and this is a walkthrough of what building it involved. No Context to Piggyback On Go's httptrace works by riding on context.Context. You build a *ClientTrace, attach it to a context with httptrace.WithClientTrace, and http.Transport pulls it back out at each phase via…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.