feat: Implement Standardized Health Check System (Issue #5) #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements a standardized health check system across all microservices to enable reliable monitoring, load balancing, and orchestration. This PR adds consistent health endpoints that can be consumed by Kubernetes liveness/readiness probes, API gateways, and monitoring systems.
Changes
New Package:
@scribemed/healthService Updates
/health,/health/live, and/health/readyendpointsKubernetes Integration
Testing
Testing
pnpm lint- All code passes lintingpnpm test- All tests passingpnpm build- All packages build successfullyHealth Check Endpoints
All services now expose three standardized endpoints:
GET /health/live- Liveness probe (always returns healthy if process is running)GET /health/ready- Readiness probe (checks critical dependencies like database)GET /health- Comprehensive health check (includes all checks + memory usage)Response Format
{ "status": "healthy" | "degraded" | "unhealthy", "timestamp": "2024-01-01T00:00:00.000Z", "service": "service-name", "checks": { "database": { "status": "healthy", "responseTime": 5 }, "memory": { "status": "healthy", "heapUsedMB": 45.2, "heapUsagePercent": 45.2 } } }Kubernetes Probes
Example probe configuration:
Files Changed
New Files:
packages/health/- Complete health check packageinfrastructure/kubernetes/staging/*-service.yaml- Service deployments with probesdocs/issues/0005-health-check-system.md- Issue documentationdocs/issues/0006-health-check-enhancements.md- Follow-up enhancements issueModified Files:
services/*/package.json- Added health package dependencyservices/*/src/server.js- Integrated health endpointsservices/*/tests/server.test.js- Added health check testsRelated Issues
Documentation
packages/health/README.mddocs/issues/0005-health-check-system.mddocs/issues/0006-health-check-enhancements.mdNext Steps
After merge, consider implementing enhancements from issue #6: