Skip to main content

StreamObserver

Trait StreamObserver 

Source
pub trait StreamObserver: Send + Sync {
    // Required method
    fn on_request(&self, stats: &RequestStats);

    // Provided methods
    fn on_progress(&self, _in_flight: u64, _buffered_bytes: u64) { ... }
    fn on_finish(&self, _summary: &StreamSummary) { ... }
}
Expand description

Observer that receives streaming metrics.

Implementations must be cheap and non-blocking: on_request is called on the scheduler task once per completed HTTP request.

Required Methods§

Source

fn on_request(&self, stats: &RequestStats)

Called once for every completed HTTP request.

Provided Methods§

Source

fn on_progress(&self, _in_flight: u64, _buffered_bytes: u64)

Called once per scheduler iteration with the current in-flight request count and undelivered reorder-buffer size. Lets observers track buffer high-water and concurrency saturation live. Default: no-op.

Source

fn on_finish(&self, _summary: &StreamSummary)

Called once when the stream finishes (or is closed early), with the final aggregate summary. Default: no-op.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§