Configuration
The complete environment reference for the Metrics Exporter — MongoDB connection, caching, timezone, per-group metric toggles, logging, and the optional health check.
The exporter is configured entirely through environment variables, set in
config/.env under the same names the container reads (documented below);
config/exporter.compose.yml passes each one straight through.
MongoDB connection
| Name | Purpose | Default | Required |
|---|---|---|---|
MONGODB_URI | Connection string (single node or replica set) | mongodb://mongodb:27017/ | No |
MONGODB_DATABASE | Database to scrape | IntelliAsk | No |
MONGO_READ_PREFERENCE | Replica read strategy | secondaryPreferred | No |
MONGO_READ_PREFERENCE accepts primary, primaryPreferred, secondary,
secondaryPreferred, or nearest.
Database name is case-sensitive
MongoDB database names are case-sensitive. Production clusters use IntelliAsk;
if a deployment uses a differently-named database, set MONGODB_DATABASE
explicitly to match.
Caching & collection
The exporter caches computed metrics in a background thread so scrapes are cheap.
| Name | Purpose | Default | Required |
|---|---|---|---|
METRICS_CACHE_ENABLED | Enable the background refresh + cache | true | No |
METRICS_CACHE_TTL | Cache refresh interval (seconds) | 60 | No |
Keep your Prometheus scrape_interval ≥ METRICS_CACHE_TTL so every scrape
gets fresh data without triggering redundant recomputation. On very large
databases, raising METRICS_CACHE_TTL (e.g. 120–300) reduces MongoDB load.
Timezone
| Name | Purpose | Default | Required |
|---|---|---|---|
METRICS_TIMEZONE | IANA timezone for daily/weekly/monthly calendar boundaries | UTC | No |
Only affects the calendar boundaries of the daily/weekly/monthly unique-user
metrics (e.g. Asia/Tokyo, Europe/London). Timestamps are stored in UTC; an
invalid value logs a warning and falls back to UTC.
Metric-group toggles
Each metric group can be enabled or disabled independently. Disabling the expensive groups (rating, tool) dramatically reduces query cost on large databases.
| Name | Group | Default | Notes |
|---|---|---|---|
ENABLE_BASIC_METRICS | Message / error / conversation counts | true | |
ENABLE_TOKEN_METRICS | Input/output token usage | true | |
ENABLE_USER_METRICS | User counts & activity (daily/weekly/monthly) | true | |
ENABLE_MODEL_METRICS | Per-model breakdowns | true | |
ENABLE_TIME_WINDOW_METRICS | 5-minute activity windows | true | |
ENABLE_RATING_METRICS | Chat ratings & feedback | true | ⚠️ expensive |
ENABLE_TOOL_METRICS | Tool / plugin usage | true | ⚠️ expensive |
ENABLE_FILE_METRICS | File upload count | true |
See the full list of metrics each group produces in the Metrics catalog.
Health check (optional)
| Name | Purpose | Default | Required |
|---|---|---|---|
INTELLIASK_URL | IntelliAsk web UI URL to probe for the intelliask_status_code metric | (unset) | No |
When set, the exporter sends a HEAD request to that URL and exposes the HTTP
status as intelliask_status_code (-1 if unreachable within ~5 s).
Logging
| Name | Purpose | Default | Required |
|---|---|---|---|
LOGGING_LEVEL | Log verbosity: debug/info/warning/error/critical | info | No |
LOGGING_FORMAT | Python logging format string | %(asctime)s - %(levelname)s - %(message)s | No |
Performance tuning for large databases
| When | Do this |
|---|---|
| 10M+ messages | ENABLE_RATING_METRICS=false |
| Large tool arrays | ENABLE_TOOL_METRICS=false |
| Frequent scrapes | ENABLE_TIME_WINDOW_METRICS=false |
| High MongoDB load | Raise METRICS_CACHE_TTL (e.g. 120–300) |
| Replica set available | MONGO_READ_PREFERENCE=secondaryPreferred |
Applying changes
After editing any EXPORTER_* value in config/.env, recreate the service:
Last updated on