Skip to main content

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

NamePurposeDefaultRequired
MONGODB_URIConnection string (single node or replica set)mongodb://mongodb:27017/No
MONGODB_DATABASEDatabase to scrapeIntelliAskNo
MONGO_READ_PREFERENCEReplica read strategysecondaryPreferredNo

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.

NamePurposeDefaultRequired
METRICS_CACHE_ENABLEDEnable the background refresh + cachetrueNo
METRICS_CACHE_TTLCache refresh interval (seconds)60No

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

NamePurposeDefaultRequired
METRICS_TIMEZONEIANA timezone for daily/weekly/monthly calendar boundariesUTCNo

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.

NameGroupDefaultNotes
ENABLE_BASIC_METRICSMessage / error / conversation countstrue
ENABLE_TOKEN_METRICSInput/output token usagetrue
ENABLE_USER_METRICSUser counts & activity (daily/weekly/monthly)true
ENABLE_MODEL_METRICSPer-model breakdownstrue
ENABLE_TIME_WINDOW_METRICS5-minute activity windowstrue
ENABLE_RATING_METRICSChat ratings & feedbacktrue⚠️ expensive
ENABLE_TOOL_METRICSTool / plugin usagetrue⚠️ expensive
ENABLE_FILE_METRICSFile upload counttrue

See the full list of metrics each group produces in the Metrics catalog.

Health check (optional)

NamePurposeDefaultRequired
INTELLIASK_URLIntelliAsk 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

NamePurposeDefaultRequired
LOGGING_LEVELLog verbosity: debug/info/warning/error/criticalinfoNo
LOGGING_FORMATPython logging format string%(asctime)s - %(levelname)s - %(message)sNo

Performance tuning for large databases

WhenDo this
10M+ messagesENABLE_RATING_METRICS=false
Large tool arraysENABLE_TOOL_METRICS=false
Frequent scrapesENABLE_TIME_WINDOW_METRICS=false
High MongoDB loadRaise METRICS_CACHE_TTL (e.g. 120–300)
Replica set availableMONGO_READ_PREFERENCE=secondaryPreferred

Applying changes

After editing any EXPORTER_* value in config/.env, recreate the service:

intelliask up exporter

Last updated on