Design: Health Check Endpoints
Design health check endpoints for a microservice or web service. Out of scope: full monitoring system, alerting, or remediation automation.
Functional Requirements
Non-Functional Requirements
+-------------------+ +---------------------+
| | | |
| Client/Monitor | <---> | Health Check API |
| | | (Liveness & Ready) |
+-------------------+ +----------+----------+
|
v
+-----------------------------+
| Dependency Check Modules |
| - Database connectivity |
| - External API availability |
| - Cache health |
+-----------------------------+
|
v
+-----------------------------+
| Configuration & Thresholds |
+-----------------------------+/ready to indicate if the service is ready to accept traffic./ready is the standard path for readiness checks.if database.isConnected() and cache.isAvailable():
return 200
else:
return 503def health_check():
if db.connected() or cache.available():
return 200
else:
return 503/health endpoint for liveness and a /ready endpoint for readiness. Which of the following best describes when the /ready endpoint should return HTTP 503?Pass the test and this pattern moves unknown