analytics profile. The Helm chart enables worker-analytics by default.
What it does
A separate Node process running the same image asworker (kodus-ai-worker),
selected at boot via WORKER_ROLE=analytics. Two crons fire from this
process and only this process:
- Ingestion (
ANALYTICS_INGESTION_CRON, default every 30 minutes) — reads pull requests and review sessions from Mongo + the OLTP Postgres, projects them into theanalyticsschema. It also runs once when the container starts. - Classifier (
ANALYTICS_CLASSIFIER_CRON, default every 30 minutes) — calls an LLM to tag each PR with a type (feature/bugfix/refactor/etc). It uses the model configured through the environment variables (see LLM Provider Configuration), not a model connected on the AI providers page.
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 on self-hosted Enterprise
1. Activate your license
SetKODUS_LICENSE_KEY in .env before starting the stack, or activate the Enterprise key on the Subscription page. A key saved in the app takes precedence over the environment variable.
2. Add the analytics block to .env
Shared Postgres (recommended):
3. Start the worker
Theanalytics profile is part of the installer’s docker-compose.yml. Start the service from the kodus-installer directory:
kodus-worker-analytics. It uses the same image and .env as worker, with WORKER_ROLE=analytics set by Compose. After an upgrade, run the command again to recreate it on the new version.
4. Migrations run in the api container
Only the api container runs migrations. With RUN_MIGRATIONS=true (the default), it creates the analytics schema and runs the warehouse migrations on boot. The worker containers never migrate, so start api before worker-analytics on a fresh install.
Reference
Pausing ingestion (advanced)
To pause either analytics job, setANALYTICS_INGESTION_DISABLED=true or ANALYTICS_CLASSIFIER_DISABLED=true (or both) in .env and apply the change with docker compose --profile analytics up -d worker-analytics.
Verifying it’s working
After boot, tail the analytics worker logs:analytics ingestion (startup) done in NNNms right after boot, then
analytics ingestion (cron) done ... and analytics classifier done ... on each
schedule. These are info-level lines, and the installer’s .env sets API_LOG_LEVEL=error, so set
API_LOG_LEVEL=info and recreate the container to see them. Only one replica runs a pass at a time. If you don’t see these lines, check that
WORKER_ROLE=analytics is set on this container only (not on the main worker, which must
stay code-review). The worker also answers GET /health on port 3334 inside the container.