Expand description
Per-instance metrics wrapper.
Wraps a base Producer / Consumer pair behind try_push / try_pop
and records:
enqueue_success,enqueue_fail(ring full)dequeue_success,dequeue_fail(ring empty)max_depth_observed(gauge; high-water mark of in-flight items)cas_retries(only set by the mpmc-disruptor path; SPSC never CAS-retries)
Counter overhead is one fetch_add per op - measurable on a hot loop, so
reach for this when you’re explicitly capturing operational stats, not
when you need the absolute lowest latency.
Structs§
- Instrumented
Consumer - Instrumented
Producer - Instrumented
Spsc - Helper that constructs a metrics-wrapped (producer, consumer, metrics) triple from a base SPSC pair.
- Ring
Metrics - Shared counter set. Hold an
Arc<RingMetrics>across producer + consumer so the snapshot reflects both sides. - Ring
Metrics Snapshot - Snapshot value-type returned by
RingMetrics::snapshot.Clone + Copyso callers can stash + compare across calls.