Discover Packages
github.com/cetrictech/go-platform-kit
health
package
Version:
v1.0.0
Opens a new window with list of versions in this module.
Published: Nov 6, 2026
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package health implements independent liveness, readiness and startup registries with bounded dependency checking.
Check must honor ctx. A misbehaving callback is isolated to at most one active invocation per registered check.
Kafka verifies actual broker metadata availability through either administration adapter.
Ping adapts a dependency client without importing its optional driver.
Pinger is satisfied by the SQL and Redis SDK clients.
Registry supports concurrent Run and Register. Configure Timeout/OnResult before serving concurrent requests.
func (*Registry) Handler ¶
Handler returns HTTP 200/503 with bounded, diagnostic-free JSON status.
Register rejects duplicate/empty dependency names.
Run executes checks in parallel, returning by each check's timeout even if a callback ignores cancellation.
A timed-out callback retains its one invocation slot until it exits; later checks report busy instead of creating runaway goroutines.
type Report struct {
Healthy bool `json:"healthy"`
Checks map[string ]Result `json:"checks"`
}
Report aggregates configured dependency checks. Use an empty registry for dependency-independent liveness.
type Result struct {
Healthy bool `json:"healthy"`
Duration time .Duration `json:"duration_ns"`
Reason string `json:"reason,omitempty"`
}
Result contains only safe status metadata; raw dependency errors are never exposed by Handler.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.