health

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package health provides component health checking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Name    string        `json:"name"`
	Status  Status        `json:"status"`
	Message string        `json:"message,omitempty"`
	Latency time.Duration `json:"latency"`
}

Check represents a single health check result.

type Checker

type Checker interface {
	Name() string
	Check(ctx context.Context) Check
}

Checker is the interface for health checks.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds all registered health checkers.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new health check registry.

func (*Registry) CheckAll

func (r *Registry) CheckAll(ctx context.Context) []Check

CheckAll runs all health checks and returns results.

func (*Registry) OverallStatus

func (r *Registry) OverallStatus(ctx context.Context) Status

OverallStatus returns the overall health status.

func (*Registry) Register

func (r *Registry) Register(checker Checker)

Register adds a health checker to the registry.

type Status

type Status string

Status represents the health status of a component.

const (
	StatusHealthy   Status = "healthy"
	StatusUnhealthy Status = "unhealthy"
	StatusDegraded  Status = "degraded"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL