Skip to content

[Backend] Health: deep readiness probe covering Postgres, Redis, and Horizon listener liveness #336

@Baskarayelu

Description

@Baskarayelu

Description

The health router (src/routes/health.ts, src/services/health/probes.ts, checks.ts) provides probes, but the Horizon listener's liveness (last event/cursor heartbeat) and outbox publisher lease health are not represented. Kubernetes (k8s/deployment.yaml) can route traffic to a pod whose listener has silently died or whose outbox is stalled, so readiness must reflect background-worker health, not just process up.

Requirements and context

  • Add readiness checks for: Postgres connectivity (src/db/pool.ts), Redis (src/cache/redis.ts), Horizon listener last-heartbeat age, and outbox publisher running state.
  • Distinguish liveness (process up) from readiness (dependencies + workers healthy) in src/services/health/probes.ts.
  • Surface degraded subsystems in the JSON body with per-check status.
  • Align with k8s/deployment.yaml probe paths.

Suggested execution

Create branch feature/deep-readiness-probes.

  • Extend src/services/health/checks.ts and probes.ts.
  • Expose listener/outbox heartbeats for the checks to read.
  • Extend tests/routes/health.test.ts and src/services/health/checks.test.ts.
  • Update docs/k8s.md and docs/monitoring.md.

Test and commit

Run npm run test. Edge cases: Redis down → ready=false, listener heartbeat stale, partial degradation. Security: health body must not leak connection strings.

Example commit message

feat: deep readiness probe including listener and outbox health

Guidelines

  • Minimum 95% test coverage
  • Clear documentation in docs/k8s.md
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend services and APIsobservabilityMetrics, logging, tracingtestingTests and coverage

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions