pub struct InMemoryObservationSink { /* private fields */ }Expand description
Bounded in-memory sink used by diagnostics and embedded runtimes.
Drain configuration is copy-on-write. Emission borrows one immutable drain generation and releases its configuration lock before invoking callbacks.
Implementations§
Source§impl InMemoryObservationSink
impl InMemoryObservationSink
Sourcepub fn with_max_bytes(capacity: usize, max_bytes: usize) -> Self
pub fn with_max_bytes(capacity: usize, max_bytes: usize) -> Self
Creates a sink with a tighter aggregate retained-byte ceiling.
Count is clamped to the public safety ceiling. The byte limit is clamped
to 1..=default_max_bytes(capacity) and is observable through
Self::pressure.
Sourcepub fn add_drain(&self, drain: Arc<dyn ObservationSink>)
pub fn add_drain(&self, drain: Arc<dyn ObservationSink>)
Adds an operational drain that receives future redacted events.
Sourcepub fn try_add_drain(&self, drain: Arc<dyn ObservationSink>) -> bool
pub fn try_add_drain(&self, drain: Arc<dyn ObservationSink>) -> bool
Attempts to add an operational drain under the attachment ceiling.
Sourcepub fn drain_count(&self) -> usize
pub fn drain_count(&self) -> usize
Returns the number of attached operational drains.
Sourcepub fn snapshot(&self) -> Vec<ObservationEvent>
pub fn snapshot(&self) -> Vec<ObservationEvent>
Returns a stable snapshot from oldest to newest.
Returns an immutable snapshot without cloning retained observations.
Sourcepub fn pressure(&self) -> InMemoryObservationPressure
pub fn pressure(&self) -> InMemoryObservationPressure
Returns current count and retained-memory pressure.
Trait Implementations§
Source§impl Clone for InMemoryObservationSink
impl Clone for InMemoryObservationSink
Source§fn clone(&self) -> InMemoryObservationSink
fn clone(&self) -> InMemoryObservationSink
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more