Skip to content

feat: add comprehensive health check endpoints #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PolNavarro
Copy link

Summary

  • Added comprehensive health check system with 3 endpoints: /health, /health/ready, and /health/live
  • Implemented detailed system monitoring including webhook validation, memory checks, and filesystem access
  • Added proper HTTP status codes for different health states (200/503)
  • Health endpoints bypass authentication for monitoring tools

New Endpoints

/health - Complete Health Check

Returns detailed JSON with:

  • Overall system status (healthy/degraded/unhealthy)
  • Individual component checks (configuration, memory, filesystem, webhooks)
  • System information (version, uptime, Rust version)
  • Webhook configuration validation

/health/ready - Readiness Check

  • Returns 200 if service is ready to handle requests
  • Returns 503 if not ready (no webhooks configured)

/health/live - Liveness Check

  • Simple 200 response if service is alive

Implementation Details

  • Non-blocking: All checks are designed to be fast
  • No authentication: Health endpoints are public for monitoring
  • Detailed validation: Checks webhook paths, script files, configuration integrity
  • Proper error handling: Different HTTP status codes based on health state

Testing

# Start server
cargo run -- -c examples/health_test.toml

# Test endpoints
curl http://localhost:8080/health
curl http://localhost:8080/health/ready
curl http://localhost:8080/health/live

Example Response

{
  "status": "healthy",
  "timestamp": 1691234567,
  "version": "0.2.2",
  "uptime_seconds": 3600,
  "checks": {
    "configuration": {
      "status": "ok",
      "message": "2 webhooks configured",
      "details": {
        "webhook_count": 2,
        "webhook_paths": ["deploy", "test"],
        "port": 8080
      }
    },
    "webhooks": {
      "status": "ok",
      "message": "All webhooks configured correctly"
    }
  }
}

Test plan

  • Compile and run the server with example configuration
  • Test /health endpoint returns detailed JSON
  • Test /health/ready returns 200 when webhooks configured
  • Test /health/live always returns 200
  • Verify health endpoints work without authentication
  • Test with invalid configurations to ensure proper error states
  • Verify existing webhook functionality remains unchanged

🤖 Generated with Claude Code

PolNavarro and others added 2 commits August 9, 2025 23:25
- Add /health endpoint with detailed system status
- Add /health/ready endpoint for readiness checks
- Add /health/live endpoint for liveness checks
- Implement webhook configuration validation
- Add filesystem and memory health checks
- Include system info and uptime tracking
- Add example configuration for testing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Complete analysis of project structure and architecture
- Security assessment with recommendations
- Dependencies and CI/CD review
- Health check summary with 5/5 rating
- Development guidelines and best practices

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant