What Exists
All application logging is done with console.error, console.warn, and console.info. Vercel’s log streaming captures this output and makes it available in the Vercel dashboard under Functions → Logs.
lib/leaderboard/request-timing.ts provides timing instrumentation for the leaderboard pipeline. Output is via console.info.
Log Prefix Conventions
Log lines use consistent prefixes to make filtering easier:
| Prefix | Source |
|---|---|
[leaderboard/score] | Score route handler |
[leaderboard/sync] | Sync route handler |
[recompute] | Recompute route handler |
[ingest] | Ingest phase in the leaderboard pipeline |
[webhook] | Webhook handler |
What Does Not Exist
There is currently no:
- Error tracking service (no Sentry, no Rollbar)
- Metrics collection (no Datadog, no Prometheus)
- Distributed tracing (no OpenTelemetry, no Jaeger)
- Alerting of any kind
- Uptime monitoring
- Audit logging
- Request ID or correlation ID tracking across services
- Structured log format (all plain text)
Log triage means manually scrolling the Vercel log stream.
Orphaned Maintenance Functions
The following SQL functions are defined in the database but are never called by the application. They must be run manually or scheduled via pg_cron or Supabase cron jobs, or the data they clean up accumulates indefinitely.
drop_old_signals_partitions(p_keep_months DEFAULT 12)
Drops signals monthly partitions older than p_keep_months. Without this, the signals table grows forever — each month’s data stays in its partition with no automatic GC.
Run via Supabase SQL Editor:
SELECT drop_old_signals_partitions(12);purge_superseded_materializations(p_before DEFAULT now() - interval '30 days')
Purges old leaderboard materializations. Without this, the leaderboard_materializations table accumulates old snapshots.
SELECT purge_superseded_materializations();purge_expired_auth_sessions() / cleanup_expired_sessions()
Removes expired rows from auth_sessions. The application only calls deleteExpiredSessions() at login time — there is no background sweep.
SELECT purge_expired_auth_sessions();Recommended Operational Schedule
There is no enforced schedule. Suggested manual or pg_cron cadence:
| Task | Suggested frequency |
|---|---|
drop_old_signals_partitions(12) | Monthly |
purge_superseded_materializations() | Weekly |
purge_expired_auth_sessions() | Daily |
To schedule these automatically, use the Supabase dashboard under Database → Cron Jobs (requires pg_cron extension, which is enabled by default in Supabase projects).