pub trait Observer:
Send
+ Sync
+ 'static {
// Provided methods
fn on_event(&self, _event: &StreamEvent) { ... }
fn on_publish_started(&self, _app: &str) { ... }
fn on_publish_ended(&self, _app: &str) { ... }
fn on_frame(&self, _key: &StreamKey, _frame: &MediaFrame) { ... }
fn on_subscriber_lagged(&self, _key: &StreamKey, _skipped: u64) { ... }
fn on_subscriber_evicted(&self, _key: &StreamKey) { ... }
fn on_rate_limited(&self, _key: &StreamKey) { ... }
fn on_stream_reaped(&self, _key: &StreamKey) { ... }
}Expand description
Telemetry observer. All methods default to no-ops so implementors override
only what they care about. Compare arcly-http’s AuditSink / HealthCheck
injection points: behaviour is supplied by the host, never reached for
through global state.
Provided Methods§
Sourcefn on_event(&self, _event: &StreamEvent)
fn on_event(&self, _event: &StreamEvent)
A stream lifecycle event was emitted.
Sourcefn on_publish_started(&self, _app: &str)
fn on_publish_started(&self, _app: &str)
A publish session started in application app.
Sourcefn on_publish_ended(&self, _app: &str)
fn on_publish_ended(&self, _app: &str)
A publish session ended in application app.
Sourcefn on_frame(&self, _key: &StreamKey, _frame: &MediaFrame)
fn on_frame(&self, _key: &StreamKey, _frame: &MediaFrame)
A frame was published. Hot-path hook — keep it cheap. The default is a no-op so the branch is trivially predicted away when no observer is installed.
Sourcefn on_subscriber_lagged(&self, _key: &StreamKey, _skipped: u64)
fn on_subscriber_lagged(&self, _key: &StreamKey, _skipped: u64)
A subscriber fell behind the broadcast buffer and skipped frames were
dropped from its view before it could read them. This is the canonical
slow-consumer signal: alert on it. Fired by
StreamHandle::subscribe_resilient.
Sourcefn on_subscriber_evicted(&self, _key: &StreamKey)
fn on_subscriber_evicted(&self, _key: &StreamKey)
A chronically slow subscriber crossed its max_lag budget and was shed.
Fired by Subscription::recv.
Sourcefn on_rate_limited(&self, _key: &StreamKey)
fn on_rate_limited(&self, _key: &StreamKey)
An ingress rate limit was exceeded for key; the protocol handler should
drop or backpressure the connection. Handlers call this from their
ingest loop (e.g. when IngestRateLimit
returns false).
Sourcefn on_stream_reaped(&self, _key: &StreamKey)
fn on_stream_reaped(&self, _key: &StreamKey)
A publish session was reaped for exceeding the engine’s idle timeout.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Observer for AuditPipeline
impl Observer for CountingObserver
impl Observer for NoopObserver
impl Observer for PrometheusObserver
metrics only.