Files
gabrielvidalandClaude Opus 5.5 72a4f84902 feat(telemetry): the hub's own metrics, a browser beacon and usage events
- GET /api/metrics: per-route latency, event-loop lag, SSE fan-out, watcher
  ticks, memo builds, delta vs full reads, runs by origin (prometheus-client,
  own registry). Owner, or Prometheus with METRICS_TOKEN (scope 'metrics').
- POST /api/telemetry: web vitals, JS errors, update lag, feature events
  from the browser, bounded and checked.
- telemetry.db: per-minute hub history, hourly per-route, usage per day
  (forever) and raw events (90 d).
- GET /api/telemetry/hub and /api/telemetry/usage for the two pages.
- /api/spawn stamps meta.origin (app | script | child | mcp | …).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 16:24:24 +01:00

16 lines
722 B
Python

"""Telemetry: how the hub itself performs and which of its features are used.
Three layers, all kept on this machine (GOAL.md → "Private"):
* ``metrics`` + ``middleware`` + ``loop`` — the backend's own numbers
(per-route latency, event-loop lag, SSE fan-out, watcher ticks) as a
Prometheus registry served at ``GET /api/metrics``;
* ``ingest`` — what the browser reports (web vitals, JS errors, how long a
transcript write takes to reach the open thread) through the
``POST /api/telemetry`` beacon;
* ``store`` — ``telemetry.db``: the per-minute history the in-app Hub card
draws (works with no Prometheus at all) and the usage events behind
``/dashboards/usage``.
See CLAUDE.md → "Telemetry"."""