// vapora-telemetry: Observability, tracing, and metrics collection
// Phase 4 Sprint 4: OpenTelemetry integration with Jaeger

pub mod error;
pub mod metrics;
pub mod spans;
pub mod tracer;

pub use error::{Result, TelemetryError};
pub use metrics::{MetricsCollector, ProviderMetrics, SystemMetrics, TaskMetrics, TokenMetrics};
pub use spans::{AgentSpan, AnalyticsSpan, KGSpan, RoutingSpan, SwarmSpan, TaskSpan};
pub use tracer::{TelemetryConfig, TelemetryInitializer};

/// Initialize telemetry system with default configuration
pub fn init() -> Result<()> {
    TelemetryInitializer::init(TelemetryConfig::default())
}

/// Initialize telemetry with custom configuration
pub fn init_with_config(config: TelemetryConfig) -> Result<()> {
    TelemetryInitializer::init(config)
}

/// Initialize minimal telemetry for testing
pub fn init_noop() -> Result<()> {
    TelemetryInitializer::init_noop()
}

/// Shutdown telemetry system
pub fn shutdown() -> Result<()> {
    TelemetryInitializer::shutdown()
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_metrics_collector_creation() {
        let collector = MetricsCollector::new();
        let metrics = collector.get_task_metrics();
        assert_eq!(metrics.total_tasks, 0);
    }
}
