Files
Colby McHenry 71a402fe6a feat(telemetry): nightly rollup cron + raw-event retention purge (CG-10)
Adds a scheduled() handler to the ingest worker that recomputes
daily_event_counts / daily_dim_counts / daily_machines for the just-completed
UTC day plus a 2-day overlap (late-arriving offline buffers), then purges raw
events past the retention window. Rollup writes are idempotent upserts, so a
re-run never double-counts. Also adds an ADMIN_TOKEN-guarded
POST /admin/rollup?day=YYYY-MM-DD for backfill/repair, and drops the PostHog
forwarding path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 21:21:17 -05:00

6 lines
348 B
Plaintext

# Copy to .dev.vars for local development (`npm run dev`) if you want to exercise
# POST /admin/rollup — without it that route 404s, which is also how a deploy that
# never ran `wrangler secret put ADMIN_TOKEN` behaves.
# The real token lives only in the deployed secret; nothing here is ever committed.
ADMIN_TOKEN="dev_admin_token_placeholder"