Skip to content

Observability: Prometheus /metrics + a /ready probe#80

Merged
jwicks31 merged 1 commit into
mainfrom
claude/observability
Jun 13, 2026
Merged

Observability: Prometheus /metrics + a /ready probe#80
jwicks31 merged 1 commit into
mainfrom
claude/observability

Conversation

@jwicks31

Copy link
Copy Markdown
Owner

What

Operational endpoints for running the server under an orchestrator / metrics scrape — the observability roadmap item. Both are public (like /health) and carry no per-tenant labels, so nothing sensitive leaks.

How

  • GET /ready — readiness probe. 200 { ready: true } when the database answers SELECT 1, else 503. Pairs with /health (liveness) for k8s-style probes.
  • GET /metrics — Prometheus exposition via prom-client on a per-instance Registry (so multiple servers in one process — the test suite — don't collide on registration). Exposes:
    • zero_http_requests_total{method,route,status} and zero_http_request_duration_seconds{method,route} — labeled by the route pattern (/v1/data/:collection/:id), so ids never explode label cardinality.
    • zero_uptime_seconds, zero_resident_memory_bytes, zero_heap_used_bytes.
    • zero_realtime_connections, zero_realtime_channels.
    • Metrics are collected on scrape (gauge collect() callbacks) — no background timers. /metrics, /health, /ready are excluded from the request metrics to avoid probe/scrape noise.

Both sit above the /v1 auth gate (like /health), so they work in every mode; restrict at the proxy/network if you want them private.

Verification

  • SQLite 66/66 including a test that /ready reports ready and /metrics returns Prometheus text with the expected metric names and a route-pattern label.
  • Postgres 48/48 (Postgres 16). Docs updated: README + /docs (Meta & health).

Next remaining roadmap item: CREATE INDEX CONCURRENTLY for safe index builds on large Postgres tables.

https://claude.ai/code/session_018efxvWw3MRjdtvE5xgBqya


Generated by Claude Code

Add operational endpoints for running the server under an orchestrator / scrape,
both public like /health and carrying no per-tenant labels.

- GET /ready — readiness probe: 200 { ready: true } when the DB answers SELECT 1,
  else 503. Pairs with /health (liveness) for k8s-style probes.
- GET /metrics — Prometheus exposition via prom-client on a per-instance registry
  (so multiple servers in one process don't collide): request rate + latency
  histogram labeled by method/route *pattern* (ids never become labels), process
  memory/uptime, and realtime connection/channel gauges. /metrics, /health, and
  /ready are excluded from the request metrics to avoid scrape/probe noise.

Verification: 66/66 SQLite (+ a test asserting /ready and the metric names +
route-pattern labels), 48/48 Postgres 16. Docs updated (README, /docs meta).
@jwicks31 jwicks31 merged commit e050bc1 into main Jun 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants