Prometheus-compatible metrics exposition for FerricStore.
Collects server statistics from Ferricstore.Stats, Ferricstore.MemoryGuard,
Ferricstore.SlowLog, and BEAM runtime sources, then formats them in the
Prometheus text exposition format (version 0.0.4).
No external dependencies are required -- the module produces a plain UTF-8 string that any Prometheus-compatible scraper can consume.
Exposed metrics
| Metric name | Type | Source |
|---|---|---|
ferricstore_connected_clients | gauge | Ranch listener connection count |
ferricstore_total_connections_received | counter | Stats.total_connections/0 |
ferricstore_total_commands_processed | counter | Stats.total_commands/0 |
ferricstore_hot_reads_total | counter | Stats.total_hot_reads/0 |
ferricstore_cold_reads_total | counter | Stats.total_cold_reads/0 |
ferricstore_used_memory_bytes | gauge | :erlang.memory(:total) |
ferricstore_keydir_used_bytes | gauge | shard ETS table memory |
ferricstore_uptime_seconds | gauge | Stats.uptime_seconds/0 |
ferricstore_blocked_clients | gauge | waiters ETS table size |
ferricstore_tracking_clients | gauge | tracking connections ETS size |
ferricstore_slowlog_entries | gauge | SlowLog.len/0 |
ferricstore_namespace_window_ms | gauge | NamespaceConfig.get_all/0 |
ferricstore_namespace_durability | gauge | NamespaceConfig.get_all/0 |
Usage
iex> text = Ferricstore.Metrics.scrape()
iex> String.contains?(text, "ferricstore_uptime_seconds")
trueThe FERRICSTORE.METRICS Redis command returns this text as a bulk string.
Summary
Functions
Handles the FERRICSTORE.METRICS Redis command.
Produces a Prometheus text exposition format string containing all FerricStore metrics.
Types
Functions
Handles the FERRICSTORE.METRICS Redis command.
Returns the Prometheus text exposition as a bulk string. Accepts no arguments.
Parameters
cmd-- the uppercased command name ("FERRICSTORE.METRICS")args-- argument list (must be empty)
Returns
The scrape text on success, or {:error, message} for wrong arguments.
@spec scrape() :: binary()
Produces a Prometheus text exposition format string containing all FerricStore metrics.
Each metric includes a # HELP line describing its purpose, a # TYPE line
declaring its Prometheus type, and a sample line with the current value.
Returns
A UTF-8 binary string in Prometheus text exposition format.
Examples
iex> text = Ferricstore.Metrics.scrape()
iex> text |> String.split("\n") |> Enum.count(&String.starts_with?(&1, "# HELP")) >= 11
true