commonware-storage 2026.5.0

Persist and retrieve data from an abstract store.
Documentation
//! Metrics for [super::Queue].

use commonware_runtime::{
    telemetry::metrics::{Gauge, MetricsExt as _},
    Metrics as RuntimeMetrics,
};

/// Metrics for [super::Queue].
pub struct Metrics {
    /// Total enqueued items.
    pub tip: Gauge,
    /// Acknowledged items.
    pub floor: Gauge,
    /// Next item to dequeue.
    pub next: Gauge,
}

impl Metrics {
    /// Create and register metrics with the given context.
    ///
    /// Metric names will be prefixed with the context's label.
    pub fn init<E: RuntimeMetrics>(context: &E) -> Self {
        Self {
            tip: context.gauge("tip", "Total enqueued items"),
            floor: context.gauge("floor", "Acknowledged items"),
            next: context.gauge("next", "Next item to dequeue"),
        }
    }
}