Skip to content

Metrics & Monitoring

The API exposes HTTP request metrics for Prometheus when enabled. Full config, runbook, and PromQL: Observability overview — Metrics.

Config

VariableDefaultDescription
METRICS_ENABLEDfalseExpose GET /metrics
METRICS_ENDPOINT/metricsPath for the endpoint
METRICS_COLLECT_DEFAULTStrueCPU, memory, event loop

Defined in apps/api/src/config/env.config.ts; implementation in apps/api/src/lib/metrics/.

Running the stack

See observability/README.md in the repo:

  1. Start the API with METRICS_ENABLED=true (and APP_PORT=4000 or match observability/prometheus.yml).
  2. Run docker compose up -d prometheus grafana.
  3. In Grafana (e.g. http://localhost:3001), add a Prometheus data source with URL http://prometheus:9090.

Example PromQL

Request rate:

promql
rate(http_requests_total[5m])

95th percentile duration by route:

promql
histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le, route))

Full metrics section: Observability overview — Metrics.


Related:

Released under the MIT License.