guiqi695/moon-prometheus-sdk/storage does not have a README file

    HistogramCell

    pub struct HistogramCell {
    boundaries : Array[Double]
    native : NativeHistogramCell
    }

    Native histogram storage keeps the mutex-protected counters in C while retaining immutable bucket boundaries in MoonBit for bucket lookup.

    HistogramCell::new

    fn HistogramCell::new(boundaries : Array[Double]) -> HistogramCell

    HistogramCell::observe

    fn HistogramCell::observe(self : HistogramCell, value : Double) -> Unit

    HistogramCell::snapshot

    HistogramCellSnapshot

    pub(all) struct HistogramCellSnapshot {
    cumulative_counts : Array[Int64]
    count : Int64
    sum : Double
    } derive(Eq,
    Debug
    )

    Detached state of one histogram cell.

    The array never aliases the mutable storage backend. Native builds obtain it from one C mutex-protected copy; portable builds copy their local array.

    Mutex

    pub struct Mutex {
    native : NativeMutex
    }

    Mutex::lock

    fn Mutex::lock(self : Mutex) -> Unit

    Mutex::new

    fn Mutex::new() -> Mutex

    Mutex::unlock

    fn Mutex::unlock(self : Mutex) -> Unit

    NativeHistogramCell

    pub type NativeHistogramCell

    NativeMutex

    pub type NativeMutex

    C-owned mutex object used to guard native Vec and Registry tables. It has no user-visible lock type in the facade and is finalized automatically.

    NativeScalarCell

    pub type NativeScalarCell

    Private C-owned scalar state. moonbit_make_external_object owns its lifetime, so the pthread mutex is finalized with the enclosing MoonBit object instead of leaking as an unmanaged external pointer.

    ScalarCell

    pub struct ScalarCell {
    native : NativeScalarCell
    }

    Native scalar storage uses one pthread mutex per metric object.

    ScalarCell::add

    fn ScalarCell::add(self : ScalarCell, delta : Double) -> Unit

    ScalarCell::get

    fn ScalarCell::get(self : ScalarCell) -> Double

    ScalarCell::new

    fn ScalarCell::new(initial : Double) -> ScalarCell

    ScalarCell::set

    fn ScalarCell::set(self : ScalarCell, value : Double) -> Unit