Skip to main content

TRACE_OP_METRIC

Constant TRACE_OP_METRIC 

Source
pub const TRACE_OP_METRIC: u8 = 4;
Expand description

Publish a METRIC sample: [4][owner:12][name:20][value(8, le)] - value at offset 33.

The name field is MET_NAME_LEN = 20, not 12. This line said 12, which is the bug the note on that constant records fixing (a metric truncated to ring.recorde); decoding by the old layout reads eight bytes of NAME as the u64 value.

A metric is a SET, not an increment. The emitting service already holds the counter - it is that service’s own state, with an owner (§3.8) - and publishes the current value; events remembers the last one published. That keeps the sink free of accumulation semantics it would otherwise have to define (what does an increment mean across a restart of either side?), and it means a service that dies leaves its final published value behind instead of taking it along - the one useful thing an observer can still learn from a service that is gone.