Skip to content

[FEAT] Story 0.6 Inter-Service Health Check & API Contract (Pattern B) #4

@yeomin4242

Description

@yeomin4242

한줄 설명

Implement comprehensive health check system with Pattern B architecture validation: Spring Boot API Gateway checks FastAPI internal service, PostgreSQL, and ChromaDB. Includes API contract verification for Spring Boot ↔ FastAPI proxy integration.

문제·기회

No response

제안 내용

No response

완료 기준(AC)

  • Spring Boot /actuator/health endpoint includes custom health indicators:
    • PostgreSQL connection (metadata database)
    • FastAPI service availability (internal proxy health)
    • Redis connection (Long Polling + Celery broker)
    • Disk space
    • Example response:
      {
        "status": "UP",
        "components": {
          "db": {
            "status": "UP",
            "details": {
              "database": "PostgreSQL",
              "validationQuery": "isValid()"
            }
          },
          "fastapi": {
            "status": "UP",
            "details": { "url": "http://ai-service:8000", "responseTime": "45ms" }
          },
          "redis": {
            "status": "UP",
            "details": { "host": "redis:6379", "ping": "PONG" }
          },
          "diskSpace": { "status": "UP" }
        }
      }
  • FastAPI /health endpoint validates:
    • Gemini API connectivity (test API call)
    • VectorDB connection (ChromaDB dev / Pinecone prod)
    • Redis connection (Celery broker + Long Polling storage)
    • Celery workers active
    • Example response:
      {
        "status": "healthy",
        "gemini_api": "connected",
        "vectordb": "connected",
        "vectordb_type": "chromadb",
        "vectordb_collections": 5,
        "redis": "connected",
        "redis_long_polling_ttl": "600s",
        "celery_workers": 2,
        "timestamp": "2025-11-14T12:00:00Z"
      }
  • Frontend /health endpoint (optional):
    • Build version
    • Backend connectivity
    • Environment (dev/prod)
  • Startup validation script scripts/verify-stack.sh:
    • Checks all services in sequence
    • Waits for services to be healthy (max 3 minutes timeout)
    • Validates Pattern B architecture (FastAPI not externally accessible)
  • API contract tests verify:
    • Spring Boot → FastAPI proxy integration
    • Request/response schema compatibility
    • Error handling (4xx/5xx responses)
  • Health check dashboard accessible at http://localhost:8080/actuator/health
  • Failing health check returns 503 Service Unavailable with detailed error
  • Prometheus metrics exposed at /actuator/prometheus for monitoring
  • Integration tests validate full request flow:
    • Frontend → Spring Boot → FastAPI → Gemini API
    • Frontend → Spring Boot → PostgreSQL

관련 참고자료

No response

관련 이슈·블로커

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions