Documentation
¶
Overview ¶
Package health provides health check functionality for TokMan.
Index ¶
- type Check
- type CheckFunc
- type Checker
- func (c *Checker) Check(ctx context.Context) Check
- func (c *Checker) CheckLiveness(ctx context.Context) Component
- func (c *Checker) CheckReadiness(ctx context.Context) Component
- func (c *Checker) HealthHandler() http.HandlerFunc
- func (c *Checker) LivenessHandler() http.HandlerFunc
- func (c *Checker) ReadinessHandler() http.HandlerFunc
- func (c *Checker) RegisterCheck(name string, fn CheckFunc)
- type Component
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check struct {
Status Status `json:"status"`
Version string `json:"version"`
Timestamp time.Time `json:"timestamp"`
Components []Component `json:"components"`
System map[string]interface{} `json:"system,omitempty"`
}
Check represents a health check result
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker performs health checks
func NewChecker ¶
NewChecker creates a new health checker
func (*Checker) CheckLiveness ¶
CheckLiveness performs a lightweight liveness check
func (*Checker) CheckReadiness ¶
CheckReadiness performs a readiness check
func (*Checker) HealthHandler ¶
func (c *Checker) HealthHandler() http.HandlerFunc
HealthHandler returns an HTTP handler for health checks
func (*Checker) LivenessHandler ¶
func (c *Checker) LivenessHandler() http.HandlerFunc
LivenessHandler returns an HTTP handler for Kubernetes liveness probes
func (*Checker) ReadinessHandler ¶
func (c *Checker) ReadinessHandler() http.HandlerFunc
ReadinessHandler returns an HTTP handler for Kubernetes readiness probes
func (*Checker) RegisterCheck ¶
RegisterCheck registers a custom health check
type Component ¶
type Component struct {
Name string `json:"name"`
Status Status `json:"status"`
Message string `json:"message,omitempty"`
Timestamp time.Time `json:"timestamp"`
Details map[string]interface{} `json:"details,omitempty"`
Latency time.Duration `json:"latency_ms"`
}
Component represents a health check component
Click to show internal directories.
Click to hide internal directories.