Skip to main content

TraceEvent

Enum TraceEvent 

Source
pub enum TraceEvent {
    ConnectTcp {
        phase: TracePhase,
        host: String,
        port: u16,
    },
    ConnectUnixSocket {
        phase: TracePhase,
        path: String,
    },
    StartTls {
        phase: TracePhase,
        server_hostname: String,
    },
    Retry {
        phase: TracePhase,
        delay_ms: u64,
    },
    Close {
        phase: TracePhase,
    },
    SendRequestHeaders {
        phase: TracePhase,
        method: String,
        target: String,
    },
    SendRequestBody {
        phase: TracePhase,
    },
    ReceiveResponseHeaders {
        phase: TracePhase,
        status: u16,
    },
    ReceiveResponseBody {
        phase: TracePhase,
    },
    ResponseClosed {
        phase: TracePhase,
    },
}
Expand description

Typed lifecycle events emitted by the transport layer.

Event names and phases match httpcore 1.0.9’s Trace context manager vocabulary. Each event has a phase (Started, Complete, Failed) and carries structured metadata as a map of string keys to opaque values.

The Python compatibility layer maps these to the dotted event names that HTTPX’s trace extension expects (e.g. connect_tcp.started).

Variants§

§

ConnectTcp

TCP connection to the target host.

Fields

§phase: TracePhase

Lifecycle phase.

§host: String

Target hostname or IP address.

§port: u16

Target port number.

§

ConnectUnixSocket

Unix domain socket connection.

Fields

§phase: TracePhase

Lifecycle phase.

§path: String

Path to the Unix domain socket.

§

StartTls

TLS handshake (client hello through finished).

Fields

§phase: TracePhase

Lifecycle phase.

§server_hostname: String

Hostname used for TLS Server Name Indication.

§

Retry

Connection retry with backoff delay.

Fields

§phase: TracePhase

Lifecycle phase.

§delay_ms: u64

Delay in milliseconds before the retry attempt.

§

Close

Connection closed.

Fields

§phase: TracePhase

Lifecycle phase.

§

SendRequestHeaders

HTTP/1.1 or HTTP/2 request headers sent.

Fields

§phase: TracePhase

Lifecycle phase.

§method: String

HTTP method (e.g. "GET").

§target: String

Request target (e.g. "/path").

§

SendRequestBody

HTTP/1.1 or HTTP/2 request body chunks sent.

Fields

§phase: TracePhase

Lifecycle phase.

§

ReceiveResponseHeaders

HTTP/1.1 or HTTP/2 response status/headers received.

Fields

§phase: TracePhase

Lifecycle phase.

§status: u16

HTTP status code.

§

ReceiveResponseBody

HTTP/1.1 or HTTP/2 response body chunks received.

Fields

§phase: TracePhase

Lifecycle phase.

§

ResponseClosed

Response stream closed; connection returned to pool or dropped.

Fields

§phase: TracePhase

Lifecycle phase.

Trait Implementations§

Source§

impl Clone for TraceEvent

Source§

fn clone(&self) -> TraceEvent

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 TraceEvent

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<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<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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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