Struct FlushGuard
pub struct FlushGuard { /* private fields */ }Expand description
Guard that flushes its observer on drop — the telemetry analogue of
AgentTurnGuard. Held for the lifetime of a short-lived agent
invocation (today: the CLI one-shot, zeroclaw agent -m ...), whose
process exits before the OTLP batch exporter / metric
PeriodicReader’s background interval fires. Without this flush all
buffered telemetry — including the never-ended gen_ai.agent.invoke
span, which is only .end()’d inside Observer::flush — is lost
when the runtime is torn down.
Long-lived callers (daemon heartbeat/cron, channel process_message,
subagent spawns) pass interactive = false and skip this guard: they
rely on the periodic export firing on its own cadence, and a flush
per turn would add a synchronous OTLP HTTP POST to every invocation.
Backend-agnostic: calls Observer::flush(), which is a no-op for
synchronous backends (Log/Verbose/Noop) and meaningless-but-
harmless for pull backends (Prometheus — see startup warning).
Implementations§
Trait Implementations§
Source§impl Drop for FlushGuard
impl Drop for FlushGuard
Auto Trait Implementations§
impl Freeze for FlushGuard
impl !RefUnwindSafe for FlushGuard
impl Send for FlushGuard
impl Sync for FlushGuard
impl Unpin for FlushGuard
impl UnsafeUnpin for FlushGuard
impl !UnwindSafe for FlushGuard
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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