Skip to main content

Module observability

Module observability 

Source
Expand description

Phantom Protocol observability subsystem.

Replaces the Phase 4.5 hand-rolled metrics module (transport::metrics). Lock-free hot-path atomics for per-packet recording plus opt-in OpenTelemetry instruments (metrics + traces) gated behind the telemetry-otel Cargo feature.

See docs/observability/refactor-plan.md for the full design and docs/observability/metrics-catalog.md for the instrument inventory. This file is the public module surface; concrete types live in the submodules below.

§Layout

  • atomics — lock-free hot-path counters (HotPathAtomics).
  • configObservabilityConfig (namespace, histogram buckets).
  • instruments — OTel instrument holder; ZST no-op when the feature is off.
  • bridge — registers ObservableCounter callbacks over the atomics.
  • attrs — typed attribute-value enums (the cardinality contract).
  • snapshotMetricsSnapshot, a cold-path read for FFI / debug.

Re-exports§

pub use attrs::leg_str;
pub use attrs::AeadAlgorithm;
pub use attrs::CookieOutcome;
pub use attrs::Direction;
pub use attrs::EarlyDataOutcome;
pub use attrs::FallbackReason;
pub use attrs::HandshakeOutcome;
pub use attrs::PathValidationOutcome;
pub use attrs::PowOutcome;
pub use attrs::ProtocolVersion;
pub use attrs::ReplayReason;
pub use attrs::ResumptionMode;
pub use config::HistogramConfig;
pub use config::ObservabilityConfig;
pub use config::ObservabilityConfigBuilder;
pub use snapshot::MetricsSnapshot;

Modules§

attrs
Typed attribute values for OpenTelemetry instruments.
config
Observability configuration.
snapshot
Cold-path snapshot of the observability state.

Structs§

Observability
Public observability facade.