Skip to content

Implement Comprehensive Deep Health Check Diagnostic Endpoint #287

Description

@Cjay-Cyber-2

Description

Operational visibility requires a deep health check endpoint (GET /health/deep) that assesses backend subsystems including PostgreSQL connectivity via Prisma, Stellar Horizon RPC responsiveness, and worker processing state before reporting overall node status.

Context & Requirements

  • Endpoint location: GET /health/deep in src/routes/health.ts.
  • Checks required:
    • Database: Simple query ping via Prisma (prisma.$queryRaw).
    • Stellar Horizon: Fetch latest ledger sequence or network root endpoint response time.
    • Environment/Worker: Check uptime and configuration state.
  • Response must return status 200 OK if all critical services respond, or 503 Service Unavailable if key dependencies fail.

Acceptance Criteria

  • Register GET /health/deep route in src/routes/health.ts.
  • Implement asynchronous checks for database ping and Horizon RPC connectivity.
  • Measure latency (in milliseconds) for each dependency check.
  • Return JSON payload containing subsystem statuses, latencies, and overall health boolean.
  • Respond with HTTP status 503 when critical checks (DB or Horizon) fail.
  • Add unit and integration tests covering normal operation and subsystem failure scenarios.

Implementation Guidance

  • Keep individual check timeouts reasonable (e.g., 3-5 seconds) so health probes do not hang.
  • Avoid exposing sensitive operational secrets or internal connection strings in response output.
  • Follow Fastify schema definitions for response serialization.

Testing & Validation

  • Run tests with npm test.
  • Validate that mock DB or Horizon failures correctly result in a 503 response code.

Submission Guidelines

  • Open a PR that includes "Closes #".
  • Ensure task assignment before starting work.
  • Maintain existing code structure and linting requirements.

Wave complexity: Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programapicomplexity: mediumDrips Wave — moderate scope, some designdevopsdrips-waveTracked in a Drips Wave program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions