Skip to main content

Module metrics

Module metrics 

Source
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§

InstrumentedConsumer
InstrumentedProducer
InstrumentedSpsc
Helper that constructs a metrics-wrapped (producer, consumer, metrics) triple from a base SPSC pair.
RingMetrics
Shared counter set. Hold an Arc<RingMetrics> across producer + consumer so the snapshot reflects both sides.
RingMetricsSnapshot
Snapshot value-type returned by RingMetrics::snapshot. Clone + Copy so callers can stash + compare across calls.