-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Labels
Description
The goal is to create a pluggable component for health check feature in aah.
Goals:
- Fundamentally application must have flexible health check implementation
- Also for cloud native - Kubernetes Liveness and Readiness probes
Design:
- Create a go library
- Repo: https://github.com/go-aah/ec-healthcheck-provider - created, ready to use
- Go Vanity for release:
aahframe.work/ec/healthcheck- yet to be done
- Spec:
- Provide an
interfacefor implementing health check reporter- interface method
func Check() error
- interface method
- Provide a method to create new health check component
- Provide methods to add one or more health check reporter into health check registry with or without interval duration to call
- e.g.:
hc.AddReporter(healthcheck.Config{/* report name, implementation based on above interface, duration, skip on error, etc... */})
- e.g.:
- Provide a method to register controller and route for the aah application (by domain name if multiple domains application)
- For non-Kubernetes - accept URL relative path for the route - returns the response payload with status code
- For Kubernetes - to add liveness and readiness endpoints (accept URL relative path for the route for both endpoints) - return only status code with empty body since Kubernetes only cares about status code
- Provide an
- Status Codes for response
200 OKif every registered health checker/reporter returnsnil503 Service Unavailableif any registered checker/reporter returnnon-nilexcept skip on error
Sample response payload (a conceptual idea, yet to be finalized)
{
"status": "OK", // OK or Service Unavailable
"timestamp": "RFC3339 or ISO 8061", // yet to be decided
"reportname": bool, // true or false, this line will be repeated for all registered health checker/reporter
}