pub trait TransportObserver: Send + Sync {
// Required method
fn on_event(&self, key: &str, event: TransportEvent);
}Required Methods§
Sourcefn on_event(&self, key: &str, event: TransportEvent)
fn on_event(&self, key: &str, event: TransportEvent)
Called synchronously on the request path, from the task that owns the
call, and — for Started — while that attempt’s semaphore permit is
held. The contract:
- Do not block, await or sleep. Copy what you need into your own
state and return. Time spent in
Startedis time the client’s parallelism budget is not doing work; time spent in any other event delays the call that reported it. - Do not call back into the client (
execute,execute_with,breaker_state). The call path is holding client state. Startedpairs with exactly one terminal event —Succeeded,FailedorCancelled— per attempt, including for a fail-fast rejection, which emits a syntheticStartedfollowed byFailed { ms: 0 }whose error haskind_name() == "breaker_open". Those two never touched the network; filter them out of request-rate figures.BreakerOpenedrepeats on every failed probe, with a longercooldowneach time and no interveningBreakerClosed. Treat it as “open until now + cooldown” — set the deadline, do not count the events.mscovers building, sending and reading the response head. It excludes waiting for a breaker cooldown, a rate-limit token, a semaphore permit, a retry back-off, and the auth round trip.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".