# `TimelessMetricsDashboard`
[🔗](https://github.com/awksedgreep/timeless_metrics_dashboard/blob/main/lib/timeless_metrics_dashboard.ex#L1)

Telemetry reporter and LiveDashboard page for TimelessMetrics.

Captures `Telemetry.Metrics` events into a Timeless store, giving you
persistent historical metrics that survive restarts — unlike the built-in
LiveDashboard charts which reset on every page load.

## Reporter (standalone — no Phoenix required)

    children = [
      {Timeless, name: :metrics, data_dir: "/var/lib/metrics"},
      {TimelessMetricsDashboard,
        store: :metrics,
        metrics:
          TimelessMetricsDashboard.DefaultMetrics.vm_metrics() ++
          TimelessMetricsDashboard.DefaultMetrics.phoenix_metrics()}
    ]

## LiveDashboard Page

    # In your router:
    live_dashboard "/dashboard",
      additional_pages: [timeless: {TimelessMetricsDashboard.Page, store: :metrics}]

# `child_spec`

Returns a child spec that starts the TimelessMetrics store + telemetry reporter.

## Options

  * `:name` — store name (default: `:timeless_metrics`)
  * `:data_dir` — data directory (default: `"priv/timeless_metrics"`)
  * `:metrics` — `Telemetry.Metrics` list (default: `DefaultMetrics.all()`)
  * `:reporter` — extra opts forwarded to Reporter (`:flush_interval`, `:prefix`)

# `metrics_history`

```elixir
@spec metrics_history(Telemetry.Metrics.t(), atom(), keyword()) :: [map()]
```

Callback for LiveDashboard's `metrics_history` option.

Queries the Timeless store for recent data points matching the given
`Telemetry.Metrics` struct and returns them in the format LiveDashboard
expects.

## Router Configuration

    live_dashboard "/dashboard",
      metrics: MyAppWeb.Telemetry,
      metrics_history: {TimelessMetricsDashboard, :metrics_history, [:my_store]}

The store atom is appended by your MFA config; LiveDashboard prepends
the metric struct, so the call becomes:

    TimelessMetricsDashboard.metrics_history(metric, :my_store)

## Options

A keyword list can be passed as a third element for additional config:

    metrics_history: {TimelessMetricsDashboard, :metrics_history, [:my_store, [prefix: "app"]]}

Supported options:

  * `:prefix` — metric name prefix (default: `"telemetry"`, must match your Reporter prefix)
  * `:history` — seconds of history to return (default: `3600`)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
