Nathan asked to see a chart. The portal now owns a daily metrics series
(metrics_daily, written 03:15 UTC by the portal's own scheduler); this is the
first surface to read it.
- New route /api/metrics proxies the portal's /admin/metrics/series (admin
token stays server-side, same pattern as /api/model-usage).
- New Trends tab, added to switchView in the same edit (every view toggled
there must be shown/hidden there). Lazy: the series loads on first visit, so
the panel's initial load is unchanged.
- Metric toggle (Members / Spend / Requests) and period toggle (30 / 90 / all
time). Fetched once at the widest range and re-rendered client-side, so the
toggles never refetch.
- Inline SVG, hand-rolled: no chart library, no CDN, no external dependency.
Colours come from the panel's existing CSS vars, so it matches the rest.
- Gaps are drawn as gaps. A NULL metric means "not measured" and the line
deliberately breaks rather than drawing through a day we never recorded
(backfilled members_active is NULL every day, by design). The sub-line says
how many days are unmeasured.
- Members shows the cumulative total; spend and requests are per-day bars.
Verified against the live 55-day series with a node harness running the real
page functions: 22 checks, including that a NULL breaks the line into two runs,
that no NaN reaches the markup, that the toggles do not refetch, and that the
SVG carries no hardcoded hex.