Documentation
¶
Overview ¶
Package health provides health check and readiness probe support.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatResults ¶ added in v0.2.0
func FormatResults(suite *DiagnosticSuite) string
FormatResults produces a human-readable terminal output of diagnostic results.
func SuggestFixes ¶ added in v0.2.0
func SuggestFixes(suite *DiagnosticSuite) []string
SuggestFixes returns prioritized fix suggestions from the suite results. Failures are listed first, then warnings.
Types ¶
type Check ¶
type Check struct {
Name string `json:"name"`
Status Status `json:"status"`
Message string `json:"message,omitempty"`
LastChecked time.Time `json:"last_checked"`
Duration time.Duration `json:"duration_ms,omitempty"`
}
Check represents a health check.
type Checker ¶
Checker is a function that performs a health check.
func APIKeyChecker ¶
APIKeyChecker checks if an API key is configured.
func DiskSpaceChecker ¶
DiskSpaceChecker checks available disk space.
type DiagnosticCheck ¶ added in v0.2.0
type DiagnosticCheck struct {
Name string
Category string
RunFn func() DiagnosticResult
}
DiagnosticCheck defines a single named check with a category and run function.
type DiagnosticResult ¶ added in v0.2.0
type DiagnosticResult struct {
Name string
Status string // "pass", "warn", "fail"
Message string
Fix string
Duration time.Duration
}
DiagnosticResult holds the outcome of a single diagnostic check.
type DiagnosticSuite ¶ added in v0.2.0
type DiagnosticSuite struct {
Results []DiagnosticResult
StartTime time.Time
Duration time.Duration
}
DiagnosticSuite holds the collected results from running diagnostics.
type Diagnostics ¶ added in v0.2.0
type Diagnostics struct {
Checks []DiagnosticCheck
// contains filtered or unexported fields
}
Diagnostics manages a collection of diagnostic checks.
func NewDiagnostics ¶ added in v0.2.0
func NewDiagnostics() *Diagnostics
NewDiagnostics creates a Diagnostics instance with built-in checks across environment, config, network, tools, and permissions categories.
func (*Diagnostics) QuickCheck ¶ added in v0.2.0
func (d *Diagnostics) QuickCheck() bool
QuickCheck returns true if all critical checks (those that would "fail") pass. It runs all checks and returns false if any check has status "fail".
func (*Diagnostics) RunAll ¶ added in v0.2.0
func (d *Diagnostics) RunAll() *DiagnosticSuite
RunAll executes all registered diagnostic checks and returns a suite of results.
func (*Diagnostics) RunCategory ¶ added in v0.2.0
func (d *Diagnostics) RunCategory(category string) *DiagnosticSuite
RunCategory executes only the checks matching the given category.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages health checks.