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§
- Aead
Algorithm - AEAD algorithm used at the record-protection layer.
- Cookie
Outcome - Outcome of a stateless-cookie validation.
- Direction
- Direction of an I/O operation.
- Early
Data Outcome - 0-RTT early-data outcome.
- Fallback
Reason - Reason a multi-path fallback was triggered.
- Handshake
Outcome - Outcome of a handshake attempt.
- Path
Validation Outcome - Outcome of a
PATH_VALIDATIONexchange. - PowOutcome
- Outcome of a proof-of-work challenge.
- Protocol
Version - 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 stableversiondimension across a future, deliberate bump. - Replay
Reason - Reason a replay-rejected packet was dropped.
- Resumption
Mode - Resumption mode for the handshake counter.
Functions§
- leg_str
- String labels for
LegType. Stable strings used as OTel attribute values; never user-facing.