Skip to content

Improve health check endpoint to verify dependencies #52

Description

@dotunv

Description

The /health endpoint returns a static OK response without checking database or Redis connectivity. This makes it unreliable for load balancers and monitoring.

Current Behavior

func (h *Handler) Health(w http.ResponseWriter, r *http.Request) {
    respondJSON(w, http.StatusOK, map[string]string{"status": "ok"})
}

Proposed Implementation

Check all dependencies and return their status:

{
  "status": "ok",
  "database": "connected",
  "redis": "connected",
  "stellar": "connected"
}
  • Return 503 if any critical dependency is down
  • Include response time for each dependency
  • Cache status briefly to avoid hammering dependencies

Acceptance Criteria

  • Health check verifies PostgreSQL connectivity
  • Health check verifies Redis connectivity
  • Returns 503 when dependencies are unavailable
  • Response includes dependency status details

Labels

enhancement backend good first issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions