Function record
pub fn record(
metric: Metric,
outcome: Outcome,
value: u64,
operation: OperationId,
)Expand description
Records one measurement as a structured tracing event.
The event is emitted on METRICS_TARGET at DEBUG — measurements are
high-frequency by nature and must not drown an operator’s INFO stream —
with exactly four fields and no message:
| Field | Type | Role |
|---|---|---|
metric | &'static str | Metric::name — label dimension |
outcome | &'static str | Outcome::name — label dimension |
value | u64 | the measurement itself |
operation | u64 | OperationId::get — a per-event value |
§The cardinality contract
metric and outcome are closed sets and are the only two fields an
exporter may use as label dimensions. Their product is bounded by this
file and is small.
operation is a value, not a label. So is every identifier that may
appear alongside these events — study, trial, worker. Promoting any of them
to a label multiplies the series count by the number of trials a study runs,
which is unbounded and is exactly the failure this design exists to prevent.
Use operation to join a measurement back to a trace, never to slice a
time series.
§Privacy
A measurement is a count or a duration. Parameter values, objective values,
command arguments, environment values, storage specifications, checkpoint
references and paths never reach this function, and value must never be
used to smuggle one.