rust_expect/metrics/mod.rs
1//! Metrics collection and reporting.
2//!
3//! This module provides metrics collection for monitoring session
4//! performance and behavior. It includes:
5//!
6//! - Core metrics (counters, gauges, histograms)
7//! - OpenTelemetry span integration (with `metrics` feature)
8//! - Prometheus export (with `metrics` feature)
9//!
10//! # Basic Usage
11//!
12//! ```rust
13//! use rust_expect::metrics::{Counter, Gauge, Timer, SessionMetrics};
14//!
15//! // Use basic metrics
16//! let counter = Counter::new();
17//! counter.inc();
18//!
19//! let gauge = Gauge::new();
20//! gauge.set(42);
21//!
22//! // Time an operation
23//! let timer = Timer::start();
24//! // ... do work ...
25//! let elapsed = timer.stop();
26//! ```
27//!
28//! # OpenTelemetry Integration (with `metrics` feature)
29//!
30//! ```rust,ignore
31//! use rust_expect::metrics::otel::{init_tracing, shutdown_tracing};
32//!
33//! // Initialize OpenTelemetry tracing
34//! init_tracing("my-service", "http://localhost:4317")?;
35//!
36//! // Your application code with tracing spans...
37//!
38//! // Clean shutdown
39//! shutdown_tracing();
40//! ```
41
42mod core;
43
44#[cfg(feature = "metrics")]
45pub mod otel;
46
47#[cfg(feature = "metrics")]
48pub mod prometheus_export;
49
50pub use core::*;