Skip to main content

HttpStat

Struct HttpStat 

Source
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 resolution
  • quic_connect - Time taken to establish QUIC connection (for HTTP/3)
  • tcp_connect - Time taken to establish TCP connection
  • tls_handshake - Time taken for TLS handshake (for HTTPS)
  • request_send - Time to send the request headers and body
  • server_processing - Time from request fully sent to first response byte
  • content_transfer - Time taken to transfer the response body
  • total - Total time taken for the entire request
  • addr - Resolved IP address and port
  • status - HTTP response status code
  • tls - TLS protocol version used
  • alpn - Application-Layer Protocol Negotiation (ALPN) protocol selected
  • cert_not_before - Certificate validity start time
  • cert_not_after - Certificate validity end time
  • cert_cipher - TLS cipher suite used
  • cert_domains - List of domains in the certificate’s Subject Alternative Names
  • body - Response body content
  • headers - Response headers
  • error - Any error that occurred during the request

Fields§

§is_grpc: bool§request_headers: HeaderMap<HeaderValue>§dns_attempted: bool

True 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: bool

When true, render the Kernel TCP block even without --verbose. Driven by the CLI --tcp-info flag.

§lang: Lang

Display 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

Source

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
Source

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.

Source

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).

Source

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”.

Source

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.

Source

pub fn is_success(&self) -> bool

Source

pub fn to_json(&self) -> Value

Trait Implementations§

Source§

impl Clone for HttpStat

Source§

fn clone(&self) -> HttpStat

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpStat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HttpStat

Source§

fn default() -> HttpStat

Returns the “default value” for a type. Read more
Source§

impl Display for HttpStat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more