Module instrument

Module instrument 

Source
Expand description

2026-09-26: Lock-free instruments: counters, gauges and power-of-two histograms. All are const-constructible, so a whole instrument set can live in a static without a lazy initialiser.

Every instrument is a set of independent relaxed atomics, so a reader may see a histogram’s count and buckets disagree by the observations in flight. Values that must be read together (a device sample) go through crate::seqcell::SeqCell instead. Recording is not level-gated here; crate::hub::Telemetry does that.

Owner: telemetry. Invariants: recording never allocates.

Structs§

Counter
2026-09-26: Monotonic count.
Gauge
2026-09-26: Last-value integer gauge.
GaugeF64
2026-09-26: Last-value float gauge: the f64’s bits in one atomic word. None is stored as NaN, so an unmeasured ratio reads as None, not 0.
Histogram
2026-09-26: A histogram with N finite power-of-two buckets plus +Inf.
HistogramSnapshot
2026-09-26: A copy of a histogram’s state, cumulative: cumulative[i] counts values <= upper_bounds[i].

Type Aliases§

CountHistogram
2026-09-26: Small counts (batch rows, prefilling sequences), bounds 1 to 1024.
MillijouleHistogram
2026-09-26: Millijoules, bounds 1 mJ to ~16.8 kJ.
NanosHistogram
2026-09-26: Nanosecond durations, bounds 1.024 µs to ~68.7 s.