Skip to main content

synwire_core/observability/
mod.rs

1//! Observability stack for the Synwire framework.
2//!
3//! This module provides tracing, metrics, and event-bus abstractions for
4//! monitoring AI agent execution. All observability features are opt-in via
5//! Cargo feature flags:
6//!
7//! - `event-bus`: In-memory publish/subscribe event bus (requires `tokio`).
8//! - `tracing`: OpenTelemetry tracing bridge and metrics collector (requires
9//!   `tracing`, `tracing-opentelemetry`, `opentelemetry`, `opentelemetry_sdk`).
10//!
11//! Core types such as [`ObservabilitySpanKind`], [`TraceContentFilter`], and the
12//! `OTel` attribute/metric constants are always available.
13
14mod content_filter;
15mod otel_attributes;
16mod otel_metrics;
17mod span_kind;
18
19pub use content_filter::TraceContentFilter;
20pub use otel_attributes::gen_ai;
21pub use otel_metrics::gen_ai_metrics;
22pub use span_kind::ObservabilitySpanKind;
23
24#[cfg(feature = "event-bus")]
25mod event_bus;
26#[cfg(feature = "event-bus")]
27pub use event_bus::{EventBus, EventBusEvent, EventFilter, EventKind, InMemoryEventBus};
28
29#[cfg(feature = "tracing")]
30mod tracing_bridge;
31#[cfg(feature = "tracing")]
32pub use tracing_bridge::{OTelTracingBridge, SpanGuard, SpanOutcome, TracingBridge};
33
34#[cfg(feature = "tracing")]
35mod attribute_mapper;
36#[cfg(feature = "tracing")]
37pub use attribute_mapper::{GenAIAttributeMapper, OTelAttributeMapper};
38
39#[cfg(feature = "tracing")]
40mod metrics_collector;
41#[cfg(feature = "tracing")]
42pub use metrics_collector::{MetricsCollector, OTelMetricsCollector};
43
44#[cfg(feature = "tracing")]
45mod tracing_config;
46#[cfg(feature = "tracing")]
47pub use tracing_config::{BatchConfig, TracingConfig};
48
49#[cfg(feature = "event-bus")]
50mod tracing_callback_handler;
51#[cfg(feature = "event-bus")]
52pub use tracing_callback_handler::TracingCallbackHandler;