pub struct HttpStat {Show 48 fields
pub is_grpc: bool,
pub request_headers: HeaderMap<HeaderValue>,
pub dns_attempted: bool,
pub dns_lookup: Option<Duration>,
pub dns_connect: Option<Duration>,
pub quic_connect: Option<Duration>,
pub tcp_connect: Option<Duration>,
pub tcp_info_post_connect: Option<TcpInfo>,
pub tcp_info_final: Option<TcpInfo>,
pub tls_handshake: Option<Duration>,
pub request_send: Option<Duration>,
pub server_processing: Option<Duration>,
pub content_transfer: Option<Duration>,
pub wire_body_size: Option<usize>,
pub time_to_first_100k: Option<Duration>,
pub server_timing: Option<Vec<ServerTiming>>,
pub alt_svc: Option<Vec<AltSvc>>,
pub hsts: Option<Hsts>,
pub total: Option<Duration>,
pub addr: Option<String>,
pub grpc_status: Option<String>,
pub status: Option<StatusCode>,
pub tls: Option<String>,
pub tls_resumed: Option<bool>,
pub tls_early_data_accepted: Option<bool>,
pub tls_ocsp_stapled: Option<bool>,
pub alpn: Option<String>,
pub subject: Option<String>,
pub issuer: Option<String>,
pub cert_not_before: Option<String>,
pub cert_not_after: Option<String>,
pub cert_cipher: Option<String>,
pub cert_domains: Option<Vec<String>>,
pub certificates: Option<Vec<Certificate>>,
pub body: Option<Bytes>,
pub body_size: Option<usize>,
pub headers: Option<HeaderMap<HeaderValue>>,
pub error: Option<String>,
pub silent: bool,
pub verbose: bool,
pub pretty: bool,
pub include_headers: Option<Vec<String>>,
pub exclude_headers: Option<Vec<String>>,
pub waterfall: bool,
pub jq_filter: Option<String>,
pub show_tcp_info: bool,
pub lang: Lang,
pub version: Option<String>,
}Expand description
Statistics and information collected during an HTTP request.
This struct contains timing information for each phase of the request, connection details, TLS information, and response data.
§Fields
dns_lookup- Time taken for DNS resolutionquic_connect- Time taken to establish QUIC connection (for HTTP/3)tcp_connect- Time taken to establish TCP connectiontls_handshake- Time taken for TLS handshake (for HTTPS)request_send- Time to send the request headers and bodyserver_processing- Time from request fully sent to first response bytecontent_transfer- Time taken to transfer the response bodytotal- Total time taken for the entire requestaddr- Resolved IP address and portstatus- HTTP response status codetls- TLS protocol version usedalpn- Application-Layer Protocol Negotiation (ALPN) protocol selectedcert_not_before- Certificate validity start timecert_not_after- Certificate validity end timecert_cipher- TLS cipher suite usedcert_domains- List of domains in the certificate’s Subject Alternative Namesbody- Response body contentheaders- Response headerserror- Any error that occurred during the request
Fields§
§is_grpc: bool§request_headers: HeaderMap<HeaderValue>§dns_attempted: boolTrue when a real DNS resolution was attempted for this request.
Stays false for IP-literal hosts, --resolve pins and proxied
requests (the proxy resolves the target itself), so exit_code()
can tell “DNS failed” apart from “DNS was never needed”.
dns_lookup: Option<Duration>§dns_connect: Option<Duration>Cold connect cost (TCP + TLS) to the DNS server. Only populated when
using DoH or DoT — for plain UDP DNS this stays None. When present,
the dns_lookup total can be split into dns_connect and a derived
dns_query = dns_lookup - dns_connect, making it possible to tell
whether DoH/DoT latency comes from TLS handshake or query processing.
quic_connect: Option<Duration>§tcp_connect: Option<Duration>§tcp_info_post_connect: Option<TcpInfo>Kernel TCP statistics sampled right after connect(2). Provides the
baseline RTT, MSS and initial cwnd before any application data flows.
Linux + macOS only — None on other platforms.
tcp_info_final: Option<TcpInfo>Kernel TCP statistics sampled after the response body has been fully
received. The diff against tcp_info_post_connect reveals retransmits
during the request — the diagnostic answer to “was Content Transfer
slow because of packet loss or just slow start?”.
tls_handshake: Option<Duration>§request_send: Option<Duration>§server_processing: Option<Duration>§content_transfer: Option<Duration>§wire_body_size: Option<usize>Bytes actually received over the wire (pre-decompression). For an
uncompressed response this matches body_size; for gzip/br/zstd
it’s smaller and is the right denominator for network throughput.
time_to_first_100k: Option<Duration>Time from the start of content_transfer until the first 100 KiB of
body bytes had arrived. Combined with the overall content_transfer
duration, it splits download throughput into “first 100 KB” vs
“tail” — the former is TCP slow-start dominated, the latter is the
steady-state rate the server can sustain.
server_timing: Option<Vec<ServerTiming>>§alt_svc: Option<Vec<AltSvc>>Parsed Alt-Svc advertisements (RFC 7838). Tells the user “this
server announced h3 on port X” without requiring a second probe.
hsts: Option<Hsts>Parsed Strict-Transport-Security policy (RFC 6797).
total: Option<Duration>§addr: Option<String>§grpc_status: Option<String>§status: Option<StatusCode>§tls: Option<String>§tls_resumed: Option<bool>§tls_early_data_accepted: Option<bool>§tls_ocsp_stapled: Option<bool>§alpn: Option<String>§subject: Option<String>§issuer: Option<String>§cert_not_before: Option<String>§cert_not_after: Option<String>§cert_cipher: Option<String>§cert_domains: Option<Vec<String>>§certificates: Option<Vec<Certificate>>§body: Option<Bytes>§body_size: Option<usize>§headers: Option<HeaderMap<HeaderValue>>§error: Option<String>§silent: bool§verbose: bool§pretty: bool§include_headers: Option<Vec<String>>§exclude_headers: Option<Vec<String>>§waterfall: bool§jq_filter: Option<String>§show_tcp_info: boolWhen true, render the Kernel TCP block even without --verbose.
Driven by the CLI --tcp-info flag.
lang: LangDisplay language for the terminal renderer. JSON output is always
in English (machine contract). Driven by --lang or auto-detected
from LC_ALL/LC_MESSAGES/LANG.
version: Option<String>Display Response Version
Implementations§
Source§impl HttpStat
impl HttpStat
Sourcepub fn exit_code(&self) -> i32
pub fn exit_code(&self) -> i32
Returns a semantic exit code based on the error type:
- 0: Success
- 1: General/unknown error
- 2: DNS resolution failure
- 3: TCP connection failure
- 4: TLS/SSL error
- 5: Timeout
- 6: HTTP 4xx client error
- 7: HTTP 5xx server error
Sourcepub fn dns_query(&self) -> Option<Duration>
pub fn dns_query(&self) -> Option<Duration>
Derived “DNS Query” phase: the portion of dns_lookup not spent on
dns_connect. Returns None when no DoH/DoT probe was performed.
Clamped to ≥ 0 because the parallel probe can race slightly ahead of
the real resolver in rare cases.
Sourcepub fn throughput_bps(&self) -> Option<f64>
pub fn throughput_bps(&self) -> Option<f64>
Overall download throughput in bytes/sec, based on wire bytes received
over the content_transfer window. Returns None when either input is
unavailable or content_transfer is zero (instant local response).
Sourcepub fn first_chunk_throughput_bps(&self) -> Option<f64>
pub fn first_chunk_throughput_bps(&self) -> Option<f64>
Throughput across the first 100 KiB of body bytes — dominated by TCP
slow-start on a cold connection. Compare with [tail_throughput_bps]
to tell “slow start” from “server streams slowly”.
Sourcepub fn tail_throughput_bps(&self) -> Option<f64>
pub fn tail_throughput_bps(&self) -> Option<f64>
Throughput of the remaining body after the first 100 KiB — the steady-state rate the server actually sustains.
pub fn is_success(&self) -> bool
pub fn to_json(&self) -> Value
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for HttpStat
impl RefUnwindSafe for HttpStat
impl Send for HttpStat
impl Sync for HttpStat
impl Unpin for HttpStat
impl UnsafeUnpin for HttpStat
impl UnwindSafe for HttpStat
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request