PhoenixMicro.Phoenix.MetricsStore (PhoenixMicro v1.0.0)

Copy Markdown View Source

In-process ring-buffer store for PhoenixMicro Telemetry metrics.

Subscribes to all [:phoenix_micro, ...] events and maintains the last N data points per metric. The LiveDashboard page reads from this store to render real-time charts without hitting a time-series database.

Start it in your supervision tree before PhoenixMicro.Application:

children = [
  PhoenixMicro.Phoenix.MetricsStore,
  # ...
]

Or rely on PhoenixMicro.Application starting it automatically when :phoenix_live_dashboard is detected.

Summary

Functions

Returns a snapshot of all metrics.

Returns a specification to start this module under a supervisor.

Returns the last N data points for a given metric key.

Returns the latest single value for a metric (most recent data point).

Functions

all()

@spec all() :: %{required(atom()) => [map()]}

Returns a snapshot of all metrics.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get(metric_key)

@spec get(atom()) :: [map()]

Returns the last N data points for a given metric key.

latest(metric_key)

@spec latest(atom()) :: map() | nil

Returns the latest single value for a metric (most recent data point).

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()