# ADR-0005: Metrics, logs and bounded cardinality

URL: https://scalws.com/docs/adr/0005-observability/
Source: `docs/adr/0005-observability.md` in the ScalWS repository

* Status: Accepted (2026-10-05)

## Decision
* `prometheus-client` (official Rust client of the Prometheus project) for metrics,
  served as text exposition on a dedicated listener (loopback by default).
* `tracing` + `tracing-subscriber` with JSON output for structured logs; one access-log
  event per request (target `scalws::access`).
* Label policy: only `tenant`, `app` (from config, bounded), `listener` (config), `method`
  (normalised to a fixed set + `OTHER`), `status` class (`1xx`..`5xx`), `handler` kind.
  Never URLs, query strings, user agents or Host values. Unrouted requests use
  `tenant="_unmatched"`.
* OpenTelemetry trace export (OTLP) is deferred until after M2 so that the dependency
  footprint is justified by a working runtime platform; spans are already emitted via
  `tracing`, so adding an OTLP layer is additive.
