pub struct ObservationLog { /* private fields */ }Expand description
The bounded in-memory sink, in one of two shapes. A capture
(Self::with_capacity, the default) keeps the first capacity facts
and counts the rest as dropped: the trace is a complete prefix or says
how much of the session it missed, which is what a comparison wants. A
ring (Self::ring) keeps the last capacity facts and counts what
it let go: a long-running host always sees its recent past, which is
what a dashboard wants. Either way Self::drain takes what is kept
and starts over, so a host that exports periodically never fills up.
Implementations§
Source§impl ObservationLog
impl ObservationLog
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
A capture keeping the first capacity facts; later ones are counted
as dropped.
Sourcepub fn ring(capacity: usize) -> Self
pub fn ring(capacity: usize) -> Self
Keeps the last capacity facts and counts evictions as dropped.
Capacity zero is raised to one.
Sourcepub fn drain(&self) -> ObservationTrace
pub fn drain(&self) -> ObservationTrace
Take the kept facts and start over: the session name and the sequence continue, the kept facts and the dropped count reset. A host that exports its trace periodically drains rather than letting a capture fill and stop.
Sourcepub fn with_clock(self, clock: Arc<dyn Clock + Send + Sync>) -> Self
pub fn with_clock(self, clock: Arc<dyn Clock + Send + Sync>) -> Self
Stamp every fact with clock’s elapsed time.
Sourcepub fn with_session(self, session: impl Into<String>) -> Self
pub fn with_session(self, session: impl Into<String>) -> Self
Name the session the trace belongs to.
Sourcepub fn finalize(&self)
pub fn finalize(&self)
The session finished normally: later readers know the trace is not a partial artifact of a killed process. A later fact reopens the capture. Hosts must drain their producers before exporting a finalized snapshot.
Sourcepub fn trace(&self) -> ObservationTrace
pub fn trace(&self) -> ObservationTrace
The facts so far.
Trait Implementations§
Source§impl Debug for ObservationLog
impl Debug for ObservationLog
Source§impl Default for ObservationLog
impl Default for ObservationLog
Source§impl Witness for ObservationLog
impl Witness for ObservationLog
Source§fn observe(&self, observation: Observation)
fn observe(&self, observation: Observation)
Auto Trait Implementations§
impl !Freeze for ObservationLog
impl !RefUnwindSafe for ObservationLog
impl !UnwindSafe for ObservationLog
impl Send for ObservationLog
impl Sync for ObservationLog
impl Unpin for ObservationLog
impl UnsafeUnpin for ObservationLog
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more