# Step 2 — Per-Phase Breakdown ## What this step delivers `latprobe` now shows a full breakdown of every phase of an HTTP request: | Phase | What it measures | |-------|-----------------| | DNS lookup | Time to resolve the hostname (`DNSStart` → `DNSDone`) | | TCP connect | Time to establish the TCP connection (`ConnectStart` → `ConnectDone`) | | TLS handshake | Time to complete TLS negotiation — HTTPS only (`TLSHandshakeStart` → `TLSHandshakeDone`) | | Server (TTFB) | Time from request sent to first response byte (`WroteRequest` → `GotFirstResponseByte`) | | Transfer | Time to download the response body (`GotFirstResponseByte` → body closed) | | Total | Wall-clock time for the entire request | The TLS row is omitted automatically for plain `http://` URLs. Implemented via `net/http/httptrace.ClientTrace` — stdlib only, no external dependencies. ## Build ```sh cd go go build -o latprobe . ``` ## Usage ```sh latprobe [url ...] ``` ## Examples ### HTTPS (all phases present) ```sh $ ./latprobe https://example.com https://example.com (200) DNS lookup : 18.21 ms TCP connect : 10.12 ms TLS handshake : 36.11 ms Server (TTFB) : 21.95 ms Transfer : 0.18 ms ───────────────────────────── Total : 88.00 ms ``` ### HTTP (TLS row omitted) ```sh $ ./latprobe http://example.com http://example.com (200) DNS lookup : 1.64 ms TCP connect : 9.29 ms Server (TTFB) : 17.96 ms Transfer : 0.07 ms ───────────────────────────── Total : 29.56 ms ``` ### Multiple URLs ```sh $ ./latprobe https://example.com https://www.google.com https://example.com (200) DNS lookup : 18.21 ms ... https://www.google.com (200) DNS lookup : 7.15 ms ... ``` ## Notes - **DNS absent on repeat connections**: when the OS has cached the DNS result, the DNS phase may be very short or absent. This is expected. - **Phases don't always sum exactly to Total**: the trace hooks introduce negligible overhead between events; the difference is typically < 1 ms.