pub struct TelemetryWriter { /* private fields */ }Expand description
Cloneable handle to the bounded background writer.
Implementations§
Source§impl TelemetryWriter
impl TelemetryWriter
Sourcepub fn new(options: WriterOptions) -> Self
pub fn new(options: WriterOptions) -> Self
Spawn the dedicated worker thread and return a cloneable handle.
None paths resolve to the installation defaults at spawn time.
Sourcepub fn enqueue_telemetry(&self, record: TelemetryRecord)
pub fn enqueue_telemetry(&self, record: TelemetryRecord)
Enqueue a legacy telemetry record. Non-blocking; overflow drops.
Sourcepub fn enqueue_trace(&self, record: RequestTrace)
pub fn enqueue_trace(&self, record: RequestTrace)
Enqueue a metadata-only request trace. Non-blocking; overflow drops.
pub fn enrich_trace( &self, request_id: &TraceId, events: Vec<ToolExecutionEvent>, )
pub fn trace_snapshot(&self, request_id: &TraceId) -> Option<RequestTrace>
Sourcepub fn stats(&self) -> WriterStats
pub fn stats(&self) -> WriterStats
Snapshot the counters.
Sourcepub fn shutdown(&self, timeout: Duration) -> ShutdownOutcome
pub fn shutdown(&self, timeout: Duration) -> ShutdownOutcome
Stop accepting new records, drain the queue until timeout, and
return typed stats. On timeout the worker stays detached and keeps
draining in the background — the caller never waits past the
deadline. Safe from sync contexts; async callers should use
Self::shutdown_async. Idempotent.
“Flushed” means every queued record was appended into the OS file
buffers (write(2) returned) — there is deliberately no fsync:
these are best-effort diagnostic logs, and surviving a kernel crash
is not part of their contract.
Sourcepub async fn shutdown_async(&self, timeout: Duration) -> ShutdownOutcome
pub async fn shutdown_async(&self, timeout: Duration) -> ShutdownOutcome
Async-safe wrapper around Self::shutdown (runs on the blocking
pool so an executor thread is never parked).
Trait Implementations§
Source§impl Clone for TelemetryWriter
impl Clone for TelemetryWriter
Source§fn clone(&self) -> TelemetryWriter
fn clone(&self) -> TelemetryWriter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TelemetryWriter
impl RefUnwindSafe for TelemetryWriter
impl Send for TelemetryWriter
impl Sync for TelemetryWriter
impl Unpin for TelemetryWriter
impl UnsafeUnpin for TelemetryWriter
impl UnwindSafe for TelemetryWriter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.