Skip to main content

Prometheus Exporter

The exporter (EXPORTER_* keys) scrapes MongoDB and exposes IntelliAsk usage metrics on host port 9100 for Prometheus. Full env reference, metric-group toggles, the metrics it exposes, and Prometheus/Grafana setup.

The exporter reads IntelliAsk's MongoDB database and exposes Prometheus metrics (usage, tokens, users, models, ratings, tools, files) on host port 9100 — an optional observability component configured entirely through env vars.

Opt-in

IntelliAsk runs without the exporter, so new installs ship with it off (listed in DISABLED_MODULES). ./intelliask provision asks Enable the metrics exporter? [y/N], and you can turn it on or off at any time:

intelliask module enable exporter
intelliask module disable exporter

Installs from before setup 1.0.4 keep their exporter running — re-provisioning never disables a module that is already on.

Full service reference

This page covers how the exporter is wired into the stack (image, port, and proxy exposure). For the full environment reference and the complete catalog of exposed intelliask_* metrics, see Services → Metrics Exporter.

Overview

Compose fileconfig/exporter.compose.yml
Service nameexporter
Image variableEXPORTER_IMAGE (e.g. intelliask-exporter:2.5.0)
Host port9100 (EXPORTER_PORT) → container 8000
Depends onMongoDB (scrapes it read-only)

Scrape it from Prometheus at http://<vm-host>:9100/metrics.

Configuration

Every exporter setting lives in config/.env and is read by the container under the same name — see Services → Metrics Exporter → Configuration for the full reference (MongoDB, caching, timezone, the per-group metric toggles, and logging) and Services → Metrics Exporter → Metrics for the complete intelliask_* catalog. Defaults are production-ready; on a very large database you can turn off the expensive metric families with the ENABLE_* flags.

After editing any value, apply it with:

intelliask up exporter

How Prometheus reaches it

Pick one of four options. ./intelliask provision asks which one you want (and the interactive installer can pre-answer it); afterwards switch with the flags below.

OptionScrape URLSet with
Directly on all interfaces (default)http://<vm-host>:9100/metrics—
This VM only (local Prometheus or SSH tunnel)http://127.0.0.1:9100/metricsintelliask module enable exporter --local-only
Its own DNS name through the proxyhttps://metrics.example.com/metricsintelliask module enable proxy --exporter-host metrics.example.com
A path of the IntelliAsk site through the proxyhttps://ask.example.com/prometheus/metricsintelliask module enable proxy --exporter-path /prometheus

The two proxy options need the bundled reverse proxy. /metrics itself is an IntelliAsk route, so the path option uses a prefix such as /prometheus; the proxy strips it before forwarding, so the exporter still serves /metrics.

The metrics endpoint has no authentication

Anyone who can reach the exporter can read your usage metrics (users, models, token counts). When you publish it on a DNS name or a path, restrict access with a firewall, VPN or an allow-list in front of the VM.

Exposing through the proxy

When the bundled reverse proxy is enabled you can serve the exporter through Caddy with the same TLS mode, keeping the raw port off the public interface:

# its own DNS name
intelliask module enable proxy --exporter-host metrics.example.com
intelliask module enable proxy --no-exporter        # stop fronting it, keep the proxy up
 
# a path of the IntelliAsk site (no extra DNS name or certificate)
intelliask module enable proxy --exporter-path /prometheus
intelliask module enable proxy --no-exporter-path

Either flag sets the variables below, binds EXPORTER_BIND=127.0.0.1: (so :9100 stays local-only), re-renders the Caddyfile, and re-applies. When the proxy stops serving the exporter (--no-exporter, --no-exporter-path or module disable proxy), the binary publishes :9100 on all interfaces again so Prometheus can scrape it directly — unless --local-only is set. It works in every TLS mode — with PROXY_TLS_MODE=off the site is plain HTTP on port 80. You can pass them alongside the other proxy flags, e.g. intelliask module enable proxy --host intelliask.example.com --exporter-path /prometheus. The variables they write to config/.env:

config/.env keyDefaultPurpose
EXPORTER_PROXY_ENABLEDfalseAdd a Caddy site for the exporter.
EXPORTER_PUBLIC_HOST(empty)Public DNS name for the exporter (e.g. metrics.example.com).
EXPORTER_PUBLIC_PATH(empty)Path of the IntelliAsk site the exporter is served under (e.g. /prometheus). Must not overlap the Admin Panel path.
EXPORTER_LOCAL_ONLYfalseKeep the raw port on 127.0.0.1 even when the proxy doesn't serve the exporter.
EXPORTER_PROXY_UPSTREAMexporter:8000In-network address Caddy forwards to.
EXPORTER_BIND(empty)Prefix for the host port publish. Kept in sync by the binary once any of the keys above is set (127.0.0.1: while local-only or served by the proxy, empty otherwise); a custom value such as an interface IP is left alone.

You can also set these by hand and re-apply with intelliask up. See Reverse Proxy & TLS for how the extra Caddy site is wired.

Prometheus scrape config

Add a job to your prometheus.yml:

scrape_configs:
  - job_name: 'intelliask'
    scrape_interval: 60s
    static_configs:
      - targets: ['<vm-host>:9100']

Served through the proxy, point the job at the HTTPS URL instead:

scrape_configs:
  - job_name: 'intelliask'
    scrape_interval: 60s
    scheme: https
    metrics_path: /prometheus/metrics   # or /metrics on its own DNS name
    static_configs:
      - targets: ['ask.example.com']

Resource limits

The exporter is lightweight; the defaults (EXPORTER_CPUS=0.25, EXPORTER_MEMORY=96m) are plenty. Raise them only if you scrape very frequently or keep every expensive metric family on a large database.

Updating the exporter

The exporter is versioned and updated independently of the main app:

# 1. Publish/pull the new build under a new tag, then in config/.env:
#    EXPORTER_IMAGE=intelliask-exporter:2.5.0
 
# 2. Pull + recreate only the exporter
intelliask update exporter

No other service restarts. To roll back, restore the previous EXPORTER_IMAGE tag.

Disabling the exporter

Don't need metrics? Remove exporter.compose.yml from COMPOSE_FILE in config/.env and run intelliask up — the service is dropped and port 9100 is freed. Add it back the same way.

Last updated on