EventSink

Trait EventSink 

Source
pub trait EventSink:
    Send
    + Sync
    + 'static {
    // Required methods
    fn record_invocation(
        &self,
        flow_id: FlowId,
        component_id: ComponentId,
        start_ns: u64,
        end_ns: u64,
        status: InvocationStatus,
    );
    fn record_element_transfer(
        &self,
        flow_id: FlowId,
        stream_id: StreamId,
        element_sequence: u64,
        queue_depth_after: u32,
    );
    fn record_backpressure(
        &self,
        flow_id: FlowId,
        stream_id: StreamId,
        activated: bool,
        queue_depth: u32,
        timestamp_ns: u64,
    );
    fn record_copy(
        &self,
        flow_id: FlowId,
        resource_id: ResourceId,
        from_component: ComponentId,
        to_component: ComponentId,
        copy_bytes: u64,
        reason: CopyReason,
    );
    fn level(&self) -> ObservabilityLevel;
}
Expand description

The hot-path trait for recording observability events.

Implemented by the observability collector (torvyn-observability) and provided to the reactor, resource manager, and host lifecycle manager.

Per Doc 05, Section 9.1: all methods must be non-blocking and allocation-free on the hot path.

Use NoopEventSink for testing or when observability is disabled.

§Examples

use torvyn_types::{NoopEventSink, EventSink, ObservabilityLevel};

let sink = NoopEventSink;
assert_eq!(sink.level(), ObservabilityLevel::Off);

Required Methods§

Source

fn record_invocation( &self, flow_id: FlowId, component_id: ComponentId, start_ns: u64, end_ns: u64, status: InvocationStatus, )

Record a component invocation completion.

Called by the reactor after every component invocation.

§HOT PATH — must be non-blocking, allocation-free.
Source

fn record_element_transfer( &self, flow_id: FlowId, stream_id: StreamId, element_sequence: u64, queue_depth_after: u32, )

Record a stream element transfer between components.

Called by the reactor when an element moves through a stream queue.

§HOT PATH — must be non-blocking, allocation-free.
Source

fn record_backpressure( &self, flow_id: FlowId, stream_id: StreamId, activated: bool, queue_depth: u32, timestamp_ns: u64, )

Record a backpressure state change.

Called by the reactor when backpressure activates or deactivates.

§WARM PATH — called per backpressure event.
Source

fn record_copy( &self, flow_id: FlowId, resource_id: ResourceId, from_component: ComponentId, to_component: ComponentId, copy_bytes: u64, reason: CopyReason, )

Record a resource copy operation.

Called by the resource manager when data is copied across a boundary.

§HOT PATH — must be non-blocking, allocation-free.
Source

fn level(&self) -> ObservabilityLevel

Returns the current observability level.

Hot-path callers can skip expensive recording at lower levels.

§HOT PATH — checked per element to skip recording.

Implementors§