health

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(ci Checker)

Register 注册健康检查项

Types

type ChaosChecker

type ChaosChecker struct{}

ChaosChecker 故障注入器,用户随机地向健康检查注入失败检查项

func (*ChaosChecker) Check

func (c *ChaosChecker) Check() (bool, map[string]string, string)

Check 检查可用状态

func (*ChaosChecker) Enabled

func (c *ChaosChecker) Enabled() bool

Enabled 是否启用

func (*ChaosChecker) GetName

func (c *ChaosChecker) GetName() string

GetName 获取名称

type Checker

type Checker interface {
	GetName() string
	Enabled() bool
	Check() (isOk bool, tags map[string]string, message string) // 实现具体的检查逻辑
}

Checker 用于表征一个业务健康度的检查项

type Result

type Result struct {
	Name    string            `json:"name"`
	OK      bool              `json:"ok"`
	Tags    map[string]string `json:"tags,omitempty"`    // 检查结果的附加信息
	Message string            `json:"message,omitempty"` // 检查结果描述
}

Result 检查项结果

func CheckAll

func CheckAll() (bool, []Result)

CheckAll 对所有检查项发起检查

Jump to

Keyboard shortcuts

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