Cached Prometheus text for expensive per-prefix metrics.
Per-prefix key counts require folding every shard keydir ETS table. That is
useful operationally, but too expensive to run directly inside every
FERRICSTORE.METRICS command. This process owns a small ETS cache so scrapes
read the last completed scan and only schedule refresh work when stale.
Summary
Functions
Returns a specification to start this module under a supervisor.
Rebuilds the prefix metrics cache synchronously.
Clears cached prefix metrics.
Starts the prefix metrics cache.
Returns the last completed prefix metrics text block.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec refresh_now(timeout()) :: :ok | {:error, :not_started}
Rebuilds the prefix metrics cache synchronously.
Tests and maintenance tooling can call this when they need a deterministic cache update.
@spec reset() :: :ok
Clears cached prefix metrics.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the prefix metrics cache.
@spec text() :: binary()
Returns the last completed prefix metrics text block.
If the cache is missing or stale, this schedules a background refresh and returns the previous value immediately. The first scrape may therefore omit prefix metrics until the refresh completes.