Observability: Prometheus /metrics + a /ready probe#80
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 answersSELECT 1, else503. Pairs with/health(liveness) for k8s-style probes.GET /metrics— Prometheus exposition viaprom-clienton a per-instanceRegistry(so multiple servers in one process — the test suite — don't collide on registration). Exposes:zero_http_requests_total{method,route,status}andzero_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.collect()callbacks) — no background timers./metrics,/health,/readyare excluded from the request metrics to avoid probe/scrape noise.Both sit above the
/v1auth gate (like/health), so they work in every mode; restrict at the proxy/network if you want them private.Verification
/readyreports ready and/metricsreturns Prometheus text with the expected metric names and a route-pattern label./docs(Meta & health).Next remaining roadmap item:
CREATE INDEX CONCURRENTLYfor safe index builds on large Postgres tables.https://claude.ai/code/session_018efxvWw3MRjdtvE5xgBqya
Generated by Claude Code