erllama_cache_counters (erllama v0.1.0)

View Source

Cache subsystem operational counters.

A single atomics array (one slot per metric) lives in persistent_term keyed by this module. Hot paths bump slots via incr/1,2; readers take a snapshot via snapshot/0.

Slot indices are defined in include/erllama_cache.hrl as ?C_* macros so callers can pass the symbolic constant rather than a magic integer.

Adapter integrations (Prometheus, statsd, OpenTelemetry, etc.) read snapshot/0 periodically; this module does not depend on any external metrics framework.

Summary

Functions

add(Slot, N)

-spec add(pos_integer(), non_neg_integer()) -> ok.

get(Slot)

-spec get(pos_integer()) -> non_neg_integer().

incr(Slot)

-spec incr(pos_integer()) -> ok.

incr(Slot, N)

-spec incr(pos_integer(), non_neg_integer()) -> ok.

init()

-spec init() -> ok.

reset()

-spec reset() -> ok.

snapshot()

-spec snapshot() -> #{atom() => non_neg_integer()}.