pub struct ObservabilityManager { /* private fields */ }Expand description
Central collector that receives events, applies privacy rules, aggregates metrics, and exports reports.
Implementations§
Source§impl ObservabilityManager
impl ObservabilityManager
Sourcepub fn new(config: ObservabilityConfig) -> Arc<ObservabilityManager>
pub fn new(config: ObservabilityConfig) -> Arc<ObservabilityManager>
Creates a shared manager with bounded event buffering.
Sourcepub fn config(&self) -> &ObservabilityConfig
pub fn config(&self) -> &ObservabilityConfig
Returns the immutable configuration used by this manager.
Sourcepub fn start_span(
self: &Arc<ObservabilityManager>,
event_type: EventType,
purpose: ObservationPurpose,
) -> SpanGuard
pub fn start_span( self: &Arc<ObservabilityManager>, event_type: EventType, purpose: ObservationPurpose, ) -> SpanGuard
Starts a measured span for an LLM or tool wrapper.
Sourcepub fn record_lifecycle_event(
&self,
event_type: EventType,
purpose: ObservationPurpose,
status: EventStatus,
duration_ms: u64,
tags: HashMap<String, String>,
payload: Option<Value>,
)
pub fn record_lifecycle_event( &self, event_type: EventType, purpose: ObservationPurpose, status: EventStatus, duration_ms: u64, tags: HashMap<String, String>, payload: Option<Value>, )
Records hook-style lifecycle events that are not LLM or tool wrapper calls.
Sourcepub fn record_event(&self, event: ObservationEvent)
pub fn record_event(&self, event: ObservationEvent)
Queues a completed event without blocking the observed call path.
Sourcepub async fn flush(&self) -> Result<(), ObservabilityError>
pub async fn flush(&self) -> Result<(), ObservabilityError>
Drains pending queued events into aggregation and raw buffers.
Sourcepub fn get_metrics(&self) -> Vec<AggregatedMetrics>
pub fn get_metrics(&self) -> Vec<AggregatedMetrics>
Returns configured aggregate metrics after draining pending events.
Sourcepub fn raw_events(&self) -> Vec<ObservationEvent>
pub fn raw_events(&self) -> Vec<ObservationEvent>
Returns retained raw events after redaction and queue draining.
Sourcepub fn generate_report(&self) -> ObservabilityReport
pub fn generate_report(&self) -> ObservabilityReport
Builds the user-facing report from the current rolling event window.
Sourcepub async fn export(&self) -> Result<ExportResult, ObservabilityError>
pub async fn export(&self) -> Result<ExportResult, ObservabilityError>
Writes configured report, aggregate, raw event, and Prometheus files.
Sourcepub fn dropped_events(&self) -> u64
pub fn dropped_events(&self) -> u64
Returns the total number of events dropped by bounded buffers.
Sourcepub fn redactor(&self) -> &Redactor
pub fn redactor(&self) -> &Redactor
Returns the redactor used by wrappers for safe payload summaries.
Sourcepub fn build_event_from_span(
&self,
context: SpanContext,
event_type: EventType,
duration: Duration,
status: EventStatus,
tokens: Option<ObservationTokenUsage>,
error: Option<ObservationError>,
tags: HashMap<String, String>,
payload: Option<Value>,
) -> ObservationEvent
pub fn build_event_from_span( &self, context: SpanContext, event_type: EventType, duration: Duration, status: EventStatus, tokens: Option<ObservationTokenUsage>, error: Option<ObservationError>, tags: HashMap<String, String>, payload: Option<Value>, ) -> ObservationEvent
Converts a completed SpanGuard into an ObservationEvent.
Sourcepub fn render_prometheus(&self) -> String
pub fn render_prometheus(&self) -> String
Renders current aggregate metrics in Prometheus text exposition format.
Sourcepub fn wants_format(&self, format: ExportFormat) -> bool
pub fn wants_format(&self, format: ExportFormat) -> bool
Returns true when a format is enabled in export.formats.
Auto Trait Implementations§
impl !Freeze for ObservabilityManager
impl !RefUnwindSafe for ObservabilityManager
impl Send for ObservabilityManager
impl Sync for ObservabilityManager
impl Unpin for ObservabilityManager
impl UnsafeUnpin for ObservabilityManager
impl UnwindSafe for ObservabilityManager
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> 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