health

package
v1.34.6 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsHealthProvider

func AsHealthProvider(f any) any

func Module

func Module() fx.Option

Types

type CheckDetail

type CheckDetail struct {
	// A human-readable description of the check.
	Description string
	// Unit of measurement for the observed value.
	ObservedUnit string
	// Observed value of the check.
	ObservedValue int
	// Status of the check.
	// It can be one of the following values: "pass", "warn", or "fail".
	Status Status
}

CheckDetail of a health check.

type CheckResult

type CheckResult struct {
	// A map of check names to their respective details.
	Checks Checks `json:"checks"`
}

CheckResult represents the result of a set of health checks.

func (CheckResult) Status

func (c CheckResult) Status() Status

Status returns the overall status of the application. It can be one of the following values: "pass", "warn", or "fail".

type Checks

type Checks map[string]CheckDetail

Checks is a map of check names to their respective details.

type Provider added in v1.34.3

type Provider interface {
	Name() string

	StartedProbe(ctx context.Context) (Checks, error)
	ReadyProbe(ctx context.Context) (Checks, error)
	LiveProbe(ctx context.Context) (Checks, error)
}

type Service

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

func NewService

func NewService(providers []Provider, logger *zap.Logger) *Service

func (*Service) CheckLiveness

func (s *Service) CheckLiveness(ctx context.Context) CheckResult

func (*Service) CheckReadiness

func (s *Service) CheckReadiness(ctx context.Context) CheckResult

func (*Service) CheckStartup

func (s *Service) CheckStartup(ctx context.Context) CheckResult

type Status

type Status string
const (
	StatusPass Status = "pass"
	StatusWarn Status = "warn"
	StatusFail Status = "fail"
)

Jump to

Keyboard shortcuts

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