Overview
The/health endpoint provides a simple health check for monitoring systems, load balancers, and uptime services. It verifies both application and database connectivity.
Endpoint: GET /health
Authentication: Not required
Rate limit: None (unlimited)
Response
Returns a JSON object with health status and database connection state.Overall health status:
healthy or unhealthyDatabase connection status:
connected or error messageError details (only present when status is
unhealthy)Examples
Success response
Failure response
If the database connection fails:Implementation
Frombackend/app.py:261:
- Acquires a connection from the PostgreSQL pool
- Executes a simple
SELECT 1query - Returns success if the query completes
- Returns error details if any step fails
Use cases
Load balancer configuration
Configure your load balancer to check/health:
AWS ALB Target Group:
Kubernetes liveness probe
Kubernetes readiness probe
Uptime monitoring
Configure monitoring services like UptimeRobot, Pingdom, or StatusCake:- URL:
https://api.kaggleingest.com/health - Check interval: 1-5 minutes
- Expected response: 200 OK with
"status": "healthy" - Alert threshold: 2-3 consecutive failures
Python health check script
Response headers
The health endpoint includes standard response headers:The
x-process-time-ms header shows how long the health check took, including database query latency. Values above 100ms may indicate database performance issues.Monitoring metrics
Track these metrics from/health responses:
- Response time: Should be <50ms under normal load
- Success rate: Should be 100% in healthy state
- Database latency: Inferred from
x-process-time-ms - Failure patterns: Intermittent vs. sustained failures
Troubleshooting
High response times (>100ms)
Possible causes:- Database connection pool exhaustion
- High database load (check running queries)
- Network latency between app and database
Intermittent failures
Possible causes:- Transient network issues
- Database connection recycling
- Momentary CPU/memory spikes
Sustained failures
Possible causes:- Database server down
- Connection pool misconfiguration
- Application crash or deadlock
Related endpoints
Rate limits
Check rate limiting configuration
Status codes
HTTP status code reference