Skip to main content

Module attrs

Module attrs 

Source
Expand description

Typed attribute values for OpenTelemetry instruments.

Every dimension the library slices a metric by is a small Copy enum here with a const fn as_str() returning a &'static str. Recording sites pass the enum; the instrument layer builds the KeyValue list.

Why typed enums rather than free-form strings: the enum is the cardinality contract. A metric can only be labeled by a value that exists as an enum variant, so the unbounded-cardinality offenders (peer_ip, session_id, stream_id) simply cannot be passed — there is no enum that admits them. See docs/observability/refactor-plan.md §4 “Cardinality contract”.

Performance: the labeled instruments these feed (record_handshake, record_replay_rejected, …) are all cold / low-frequency event paths, so the KeyValue list is built per-call. The genuinely hot path (per-packet counts) does NOT go through here — it uses lock-free atomics drained by ObservableCounter callbacks (bridge.rs), which build their KeyValues once per SDK collection cycle, not per packet. Per-call attribute construction on the cold paths is not worth interning away.

as_str() is const and the enums are feature-independent, so this module compiles identically with or without telemetry-otel — call sites need no #[cfg] guards.

Enums§

AeadAlgorithm
AEAD algorithm used at the record-protection layer.
CookieOutcome
Outcome of a stateless-cookie validation.
Direction
Direction of an I/O operation.
EarlyDataOutcome
0-RTT early-data outcome.
FallbackReason
Reason a multi-path fallback was triggered.
HandshakeOutcome
Outcome of a handshake attempt.
PathValidationOutcome
Outcome of a PATH_VALIDATION exchange.
PowOutcome
Outcome of a proof-of-work challenge.
ProtocolVersion
Wire-protocol version label for handshake metrics. Pinned — the protocol is not negotiated (one wire version), so this is always Current. The variant is kept (rather than dropping the metric attribute) so dashboards retain a stable version dimension across a future, deliberate bump.
ReplayReason
Reason a replay-rejected packet was dropped.
ResumptionMode
Resumption mode for the handshake counter.

Functions§

leg_str
String labels for LegType. Stable strings used as OTel attribute values; never user-facing.