1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! # torvyn-observability
//!
//! Tracing, metrics, diagnostics, and runtime inspection for the Torvyn
//! reactive streaming runtime.
//!
//! This crate provides the observability subsystem defined in HLI Doc 05.
//! It implements the [`EventSink`](torvyn_types::EventSink) trait from
//! `torvyn-types` for hot-path recording and manages three internal
//! subsystems:
//!
//! - **Metrics**: Pre-allocated counters, histograms, and gauges scoped per
//! flow, component, and stream.
//! - **Tracing**: Trace context propagation, sampling, and span ring buffers
//! for retroactive export.
//! - **Events**: Structured diagnostic events for lifecycle, performance,
//! error, security, and resource state transitions.
//!
//! ## Architecture
//!
//! The [`ObservabilityCollector`] is the central orchestrator. It:
//! - Implements `EventSink` for the reactor, resource manager, and host
//! lifecycle manager.
//! - Owns the [`MetricsRegistry`] that holds pre-allocated per-flow metrics.
//! - Manages the event channel and diagnostic event buffer.
//! - Provides [`FlowObserver`] handles to the reactor for per-flow recording.
//!
//! ## Observability Levels
//!
//! | Level | Overhead | What's collected |
//! |-------|----------|------------------|
//! | Off | 0 | Nothing |
//! | Production | < 500ns/element | Counters, histograms, sampled traces |
//! | Diagnostic | < 2μs/element | All of Production + per-element spans, events |
//!
//! Level switching is atomic and does not require restarting flows.
// Re-exports for public API.
pub use BenchmarkReport;
pub use ;
pub use ObservabilityConfig;
pub use ;
pub use ;
pub use ;