Skip to main content

TraceObserver

Trait TraceObserver 

Source
pub trait TraceObserver:
    Send
    + Sync
    + Debug {
    // Required method
    fn on_event(&self, event: &TraceEvent) -> OnEventAction;
}
Expand description

Callback trait for receiving trace events from the transport layer.

Implementations must be Send + Sync because trace observers are stored on requests that may be sent across tokio tasks. The callback is invoked synchronously within the transport’s async context; it must not block or perform I/O.

For Python bindings, the implementation acquires the GIL only at callback delivery points, never across network waits.

The return value controls whether the transport should continue or abort. On Abort, the transport should short-circuit and return an error; the binding layer checks the error slot and surfaces the original callback exception.

Required Methods§

Source

fn on_event(&self, event: &TraceEvent) -> OnEventAction

Called when a trace event occurs.

Returns Continue to let the transport proceed, or Abort to signal that the transport should stop immediately.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§