WORKER_ROLE=analytics) that powers the Cockpit dashboards (DORA-style metrics, PR lifecycle, and LLM-based PR classifier).
Cockpit analytics is 100% free and open-source. Running the analytics worker as a dedicated service keeps analytical aggregation queries separated from real-time code-review pipelines.
What it does
A separate Node process running the same image asworker (fossa-ai-worker),
selected at boot via WORKER_ROLE=analytics. Two crons fire from this
process and only this process:
- Ingestion (
ANALYTICS_INGESTION_CRON, default*/30 * * * *) — reads pull requests and review sessions from Mongo + the OLTP Postgres, projects them into theanalyticsschema. - Classifier (
ANALYTICS_CLASSIFIER_CRON, default*/15 * * * *) — calls an LLM to tag each PR with a type (feature/bugfix/refactor/etc).
worker keeps the code-review event loop
unaffected by long-running ingestion queries.
Topology
The analytics warehouse is a Postgres schema, not a separate database. Two supported layouts:- Shared Postgres (recommended for self-hosted) — leave
ANALYTICS_PG_DB_HOSTempty. The config loader falls back to the mainAPI_PG_DB_*vars and creates ananalyticsschema in the same instance. One DB to back up and operate. - Dedicated Postgres — set the full
ANALYTICS_PG_DB_*block to point at a separate instance. Use this when you want analytical queries fully isolated from the OLTP write path.
Enabling in Self-Hosted
1. Add the service to docker-compose.yml
worker service — only WORKER_ROLE=analytics
flips it into ingestion mode.
2. Add the analytics block to .env
Shared Postgres (recommended):
3. Boot — migrations run automatically
Theworker-analytics container shares the same prod-entrypoint.sh as
api/worker/webhooks. With RUN_MIGRATIONS=true (installer default),
the analytics warehouse migrations (pnpm run analytics:migration:run:prod)
run on first boot, creating the analytics schema and its tables.
Reference
Pausing ingestion (advanced)
To stop ingestion at runtime without removing the container, setANALYTICS_INGESTION_DISABLED=true and/or ANALYTICS_CLASSIFIER_DISABLED=true
and restart worker-analytics. The cron stays scheduled but each tick
short-circuits. Use this for incident triage, not as a long-term config —
they are managed primarily for cloud and may not appear in the installer
template.
Verifying it’s working
After boot, tail the analytics worker logs:analytics ingestion done in NNNms — {...} every
30 minutes and analytics classifier done ... every 15 minutes. If you
don’t, check that WORKER_ROLE=analytics is set on this container only
(not on the main worker — that one must stay code-review).