healthy

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HealthGroupPath      = "/healthx"
	HealthLivenessPath   = "/liveness"
	HealthReadinessPath  = "/readiness"
	HealthStartupPath    = "/startup"
	HealthLiveness       = "liveness"
	HealthReadiness      = "readiness"
	HealthStartup        = "startup"
	CheckInterval        = time.Second * 5
	CheckIntervalTimeOut = CheckInterval * 3
	HealthStatus         = "HEALTH_STATUS"
	StatusOpen           = "open"
	StatusClose          = "close"
)

Variables

View Source
var (
	HealthyFile = filepath.Join(os.TempDir(), "dio.healthy")
)

Functions

func CheckCtlHealthyStat

func CheckCtlHealthyStat(healthType string) error

func CheckGrpcHealthy

func CheckGrpcHealthy(grpcAddr, checkType string) error

func CheckHttpHealthyStat

func CheckHttpHealthyStat(url string, checkType string) error

func CheckerFuncRun

func CheckerFuncRun(checkType string) error

func RegLivenessCheckers

func RegLivenessCheckers(checkers ...Checker)

func RegReadinessCheckers

func RegReadinessCheckers(checkers ...Checker)

func RegStartupCheckers

func RegStartupCheckers(checkers ...Checker)

func SetGrpcHealthy

func SetGrpcHealthy(grpcAddr string, checkType string, status bool) error

func SetGrpcHealthyClose

func SetGrpcHealthyClose(grpcAddr string, checkType string) error

func SetGrpcHealthyOpen

func SetGrpcHealthyOpen(grpcAddr string, checkType string) error

func SetHttpHealthy

func SetHttpHealthy(url string, checkType string, status string) error

func SetHttpHealthyClose

func SetHttpHealthyClose(url string, checkType string) error

func SetHttpHealthyOpen

func SetHttpHealthyOpen(url string, checkType string) error

Types

type Checker

type Checker func() error

type GrpcHealthyServer

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

func GetGrpcHealthyServer

func GetGrpcHealthyServer() *GrpcHealthyServer

func (*GrpcHealthyServer) HealthLiveness

func (*GrpcHealthyServer) HealthLivenessSet

func (h *GrpcHealthyServer) HealthLivenessSet(ctx context.Context, req *pb.HealthyStatus) (*pb.HealthyResponse, error)

func (*GrpcHealthyServer) HealthReadiness

func (*GrpcHealthyServer) HealthReadinessSet

func (h *GrpcHealthyServer) HealthReadinessSet(ctx context.Context, req *pb.HealthyStatus) (*pb.HealthyResponse, error)

func (*GrpcHealthyServer) HealthStartup

func (*GrpcHealthyServer) HealthStartupSet

func (h *GrpcHealthyServer) HealthStartupSet(ctx context.Context, req *pb.HealthyStatus) (*pb.HealthyResponse, error)

type Health

type Health struct {
}

func New

func New() *Health

func (*Health) FileObserve

func (h *Health) FileObserve(d time.Duration) error

func (*Health) Stat

func (h *Health) Stat() (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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