pub struct SessionTelemetry { /* private fields */ }Expand description
Zero-overhead telemetry collector for speech-to-speech sessions.
Designed for the three-lane processor model:
- Fast lane (sync, <1ms): No telemetry calls — pure audio/text forwarding.
- Telemetry lane (async, debounced): Calls
record_*methods on every event. These use only atomic operations — no allocations, no locks, no syscalls. - Control lane (async): Calls
snapshot()at turn boundaries to get aggregated stats as a JSON value ready to send to the browser.
Implementations§
Source§impl SessionTelemetry
impl SessionTelemetry
Sourcepub fn record_audio_out(&self, byte_len: usize)
pub fn record_audio_out(&self, byte_len: usize)
Record an outgoing audio chunk. Called from the telemetry lane.
Sourcepub fn record_vad_end(&self)
pub fn record_vad_end(&self)
Record VAD end (user stopped speaking).
Sourcepub fn record_text_send(&self)
pub fn record_text_send(&self)
Record that user sent a text message (for text-input latency tracking).
Sourcepub fn record_text_out(&self)
pub fn record_text_out(&self)
Record first model text output (TextDelta). Tracks text-input latency.
Sourcepub fn record_interruption(&self)
pub fn record_interruption(&self)
Record an interruption (barge-in).
Sourcepub fn record_turn_complete(&self)
pub fn record_turn_complete(&self)
Record turn completion for duration tracking.
Sourcepub fn record_usage(
&self,
total: Option<u32>,
prompt: Option<u32>,
response: Option<u32>,
cached: Option<u32>,
thoughts: Option<u32>,
)
pub fn record_usage( &self, total: Option<u32>, prompt: Option<u32>, response: Option<u32>, cached: Option<u32>, thoughts: Option<u32>, )
Record token usage from a UsageMetadata event.
Sourcepub fn mark_turn_start(&self)
pub fn mark_turn_start(&self)
Mark the beginning of a new turn (e.g., when model starts responding).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SessionTelemetry
impl RefUnwindSafe for SessionTelemetry
impl Send for SessionTelemetry
impl Sync for SessionTelemetry
impl Unpin for SessionTelemetry
impl UnwindSafe for SessionTelemetry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more