Lightweight in-memory counters for cache effectiveness and overload signals, aggregated from telemetry events:
[:gamend, :cache, :command, :stop]— cache reads (:fetch), keyed by the first element of the cache key tuple (:accounts,:kv, …), classified as hit or miss.[:gamend, :rate_limit, :deny]— rate-limiter denials by scope.[:gamend, :async, :overload]— async tasks run inline because the task supervisor was at capacity.
Counters live in a public ETS table written via :ets.update_counter from
the telemetry handler (caller process), so the hot path never crosses a
process boundary. snapshot/0 powers the admin dashboard panel; the same
events feed Prometheus via GamendWeb.PromEx.CachePlugin.
Summary
Functions
Returns a specification to start this module under a supervisor.
Resets all counters (admin dashboard action).
Returns aggregated counters
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec reset() :: :ok
Resets all counters (admin dashboard action).
@spec snapshot() :: map()
Returns aggregated counters:
%{
cache: [%{prefix: :accounts, hits: 10, misses: 2, hit_rate: 0.83}, ...],
rate_limit_denies: %{"auth" => 3, ...},
async_overloads: 0
}