Module telemetry
Expand description
Operation correlation and bounded metrics.
Two seams live here, and both exist so that observability can survive a process boundary without this crate acquiring an opinion about where the data goes.
OperationId is the correlation key: one id is minted at an operation
boundary and carried by every StudyEvent that
operation emits, so a consumer can stitch a trial’s
Waiting -> Running -> Complete story back together instead of guessing
from timestamps. It is a plain u64 newtype and Copy because
StudyEvent is Copy and every emit site
depends on that.
record is the metric hook: a closed Metric × Outcome pair, a
u64 value and the operation it belongs to, emitted as one structured
tracing event on the METRICS_TARGET target.
Hydrated study snapshots additionally report their trial, side-state, and
pending-finalization counts through three closed-cardinality metrics; those
observations use OperationId::NONE because they are not lifecycle work.
§No global state, no subscriber
The only process-global things in this module are the id counter and the
active-lease gauge. Nothing here installs a tracing subscriber, allocates
a buffer, or spawns a thread — an application installs a subscriber and
owns the exporter. Without one, record is a disabled-callsite check and
a return.
Structs§
- Operation
Id - Correlates every event emitted by one logical operation.
Enums§
Constants§
- METRICS_
TARGET - The
tracingtarget everyrecordevent is emitted on.
Functions§
- record
- Records one measurement as a structured
tracingevent.