Skip to content

feat: add Prometheus metrics, health checks, and readiness endpoints#528

Open
lakhansamani wants to merge 1 commit intomainfrom
feat/prometheus-metrics-health
Open

feat: add Prometheus metrics, health checks, and readiness endpoints#528
lakhansamani wants to merge 1 commit intomainfrom
feat/prometheus-metrics-health

Conversation

@lakhansamani
Copy link
Copy Markdown
Contributor

Summary

  • Adds Prometheus metrics package with HTTP request counters, duration histograms, auth event counters, and active session gauge
  • Implements HealthCheck(ctx) on all 6 DB providers (SQL, MongoDB, ArangoDB, Cassandra, DynamoDB, Couchbase)
  • Adds /healthz endpoint (storage health), /readyz endpoint (storage + memory store), /metrics endpoint (Prometheus)
  • Adds metrics middleware to record request count and latency per method/path/status

Related

Ref: RFC #506

Test plan

  • Run go build ./... — compiles clean
  • Run integration tests: go test -p 1 -v -run "TestHealthHandler|TestReadyHandler" ./internal/integration_tests/
  • Verify /metrics endpoint returns Prometheus format
  • Verify /healthz returns {"status":"ok"} with healthy DB

🤖 Generated with Claude Code

- Add github.com/prometheus/client_golang dependency
- Create internal/metrics package registering HTTPRequestsTotal, HTTPRequestDuration, AuthEventsTotal, and ActiveSessions collectors
- Add HealthCheck(ctx) method to the storage.Provider interface and implement it for all six DB providers (sql, mongodb, arangodb, cassandradb, dynamodb, couchbase)
- Replace the simple /health string handler with a storage-backed JSON liveness handler (/healthz) and a new readiness handler (/readyz)
- Add MetricsMiddleware() and MetricsHandler() to the http_handlers.Provider interface and implement them
- Register /healthz, /readyz, /metrics routes and MetricsMiddleware in the Gin router
- Call metrics.Init() during server startup in cmd/root.go
- Add integration tests for /healthz and /readyz endpoints
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.

1 participant