Skip to main content

EventSink

Trait EventSink 

Source
pub trait EventSink:
    Send
    + Sync
    + 'static {
    // Required methods
    fn emit(&self, payload: &str);
    fn flush(&self);
}
Expand description

Re-export the canonical EventSink trait from auths-telemetry. Synchronous, fire-and-forget sink for structured telemetry payloads.

Implementations are responsible for persistence, buffering, and flushing. emit() must never block the caller; defer I/O to a background thread or accumulate in memory. flush() blocks until all previously-emitted payloads have been persisted.

Usage:

use auths_telemetry::ports::EventSink;

struct NullSink;
impl EventSink for NullSink {
    fn emit(&self, _payload: &str) {}
    fn flush(&self) {}
}

Required Methods§

Source

fn emit(&self, payload: &str)

Emit a JSON-serialized event payload. Must not block.

Source

fn flush(&self)

Block until all previously-emitted payloads have been written.

Implementors§

Source§

impl<W> EventSink for WriterSink<W>
where W: Write + Send + Sync + 'static,