healthcheck

package
v0.0.0-...-432d548 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HealthcheckPayloadSignature        = "signature"
	HealthcheckPayloadCustominfo       = "customInfo"
	HealthcheckPayloadGlobalCustominfo = "globalCustomInfo"
	HealthcheckPayloadIdentifier       = "identifier"
	HealthcheckPayloadProcessVersion   = "porcessVersion"
	HealthcheckPayloadSchedulerInfo    = "schedulerInfo"
	HealthcheckPayloadPreload          = "preload"
)

Healthcheck meta keys

View Source
const (
	// SuccessSynced is used as part of the Event 'reason' when a HealthChecker is synced
	SuccessSynced = "Synced"
)

Variables

View Source
var (
	// HealthCheckTaskCount task数
	HealthCheckTaskCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "carbon",
			Subsystem: "healthcheck",
			Name:      "healthcheck_task_counter",
			Help:      "no help can be found here",
		},
		[]string{},
	)

	// HealthCheckTaskLatency task一轮耗时
	HealthCheckTaskLatency = prometheus.NewSummaryVec(
		prometheus.SummaryOpts{
			Namespace:  "carbon",
			Subsystem:  "healthcheck",
			Name:       "healthcheck_task_latency",
			Help:       "no help can be found here",
			MaxAge:     metric.SummaryMaxAge,
			AgeBuckets: metric.SummaryAgeBuckets,
			Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
		},
		[]string{"cluster", "application", "rollingset"},
	)

	//Lv7HealthCheckHTTPLatency lv7 http 心跳延迟
	Lv7HealthCheckHTTPLatency = prometheus.NewSummaryVec(
		prometheus.SummaryOpts{
			Namespace:  "carbon",
			Subsystem:  "healthcheck",
			Name:       "lv7_healthcheck_http_latency",
			Help:       "no help can be found here",
			MaxAge:     metric.SummaryMaxAge,
			AgeBuckets: metric.SummaryAgeBuckets,
			Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
		},
		[]string{"cluster", "application", "rollingset", "group", "role", "success"},
	)

	//Lv7HealthCheckHTTPPV lv7 http pv
	Lv7HealthCheckHTTPPV = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "carbon",
			Subsystem: "healthcheck",
			Name:      "lv7_healthcheck_http_pv",
			Help:      "no help can be found here",
		},
		[]string{"cluster", "application", "rollingset", "group", "role", "success", "code"},
	)

	// HealthCheckCounter 健康检查次数
	HealthCheckCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "carbon",
			Subsystem: "healthcheck",
			Name:      "healthcheck_counter",
			Help:      "no help can be found here",
		},
		[]string{"cluster", "application", "rollingset", "group", "role"},
	)

	//SendTargetE2ELatency 全联路调度延迟
	SendTargetE2ELatency = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "carbon",
			Subsystem: "healthcheck",
			Name:      "send_target_e2e_latency",
			Help:      "no help can be found here",
		},
		[]string{"cluster", "application", "group", "status"},
	)
)
View Source
var BatchCheckTimeOut = time.Second * 5

BatchCheckTimeOut 批量执行check超时时间

View Source
var DefaultLostCountThreshold = int32(5)

DefaultLostCountThreshold Lost阈值

View Source
var DefaultLostTimeout = int64(300)

DefaultLostTimeout Lost超时时间

Functions

func IsEquals

func IsEquals(healthCondition1 *carbonv1.HealthCondition, healthCondition2 *carbonv1.HealthCondition) bool

IsEquals 比较两个healthCondition是否相同

Types

type AdvancedLv7HealthChecker

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

AdvancedLv7HealthChecker adv心跳执行器

func NewAdvancedLv7HealthChecker

func NewAdvancedLv7HealthChecker(helper Helper, rollingSet *carbonv1.RollingSet) *AdvancedLv7HealthChecker

NewAdvancedLv7HealthChecker 创建一个

type Controller

type Controller struct {
	schema.GroupVersionKind
	controller.DefaultController
	// contains filtered or unexported fields
}

Controller is the controller implementation for HealthChecker resources

func NewController

func NewController(
	kubeclientset kubernetes.Interface,
	carbonclientset clientset.Interface, rollingSetInformer informers.RollingSetInformer,
	workernodeInformer informers.WorkerNodeInformer) *Controller

NewController returns a new healthcheck controller

func (*Controller) Sync

func (c *Controller) Sync(key string) error

Sync compares the actual state with the desired, and attempts to converge the two.

func (*Controller) WaitForCacheSync

func (c *Controller) WaitForCacheSync(stopCh <-chan struct{}) bool

WaitForCacheSync wait for informers synced

type DefaultHealthChecker

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

DefaultHealthChecker 结构体

func NewDefaultHealthChecker

func NewDefaultHealthChecker(helper Helper) *DefaultHealthChecker

NewDefaultHealthChecker 创建一个新的NewDefaultHealthChecker

type HealthChecker

type HealthChecker interface {
	// contains filtered or unexported methods
}

HealthChecker 健康检查接口

type HealthCheckerInfo

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

HealthCheckerInfo 保存HealthChecker的信息

type Helper

type Helper interface {
	Sync(workernode *carbonv1.WorkerNode, healthCondition *carbonv1.HealthCondition) bool
	GetWorkerNode(workernode *carbonv1.WorkerNode) (*carbonv1.WorkerNode, error)
	GetHTTPClient() *common.HTTPClient
}

Helper 结构体, 传入给healthchecker使用

type Lv7HealthChecker

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

Lv7HealthChecker 心跳执行器

func NewLv7HealthChecker

func NewLv7HealthChecker(helper Helper, rollingSet *carbonv1.RollingSet) *Lv7HealthChecker

NewLv7HealthChecker 创建一个

type Manager

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

Manager 结构体,负责管理多个rollingset的心跳任务

func NewHealthCheckManager

func NewHealthCheckManager(resourceManager util.ResourceManager,
	workernodeLister listers.WorkerNodeLister) Manager

NewHealthCheckManager 创建一个Manager

func (*Manager) Close

func (hm *Manager) Close() error

Close 关闭所有任务,并清空healthCheckerChanMap

func (*Manager) Process

func (hm *Manager) Process(key string, rollingSet *carbonv1.RollingSet) error

Process key在healthCheckerChanMap中则更新任务, 否则创建新的task

type Task

type Task struct {
	utils.LoopJob
	// contains filtered or unexported fields
}

Task 结构体,管理一个rollingset的心跳

func NewHealthCheckTask

func NewHealthCheckTask(
	healthCheckerInfo *HealthCheckerInfo,
	rollingSet *carbonv1.RollingSet,
	resourceManager util.ResourceManager,
	httpClient *common.HTTPClient,
	executor *utils.AsyncExecutor,
	workernodeLister listers.WorkerNodeLister) *Task

NewHealthCheckTask 创建一个Task

func (*Task) GetHTTPClient

func (ht *Task) GetHTTPClient() *common.HTTPClient

GetHTTPClient 返回httpclient对象

func (*Task) GetWorkerNode

func (ht *Task) GetWorkerNode(workernode *carbonv1.WorkerNode) (*carbonv1.WorkerNode, error)

GetWorkerNode GetWorkerNode

func (*Task) Sync

func (ht *Task) Sync(workernode *carbonv1.WorkerNode, healthCondition *carbonv1.HealthCondition) bool

Sync 同步workernode对象状态

type TaskCondition

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

TaskCondition 保存Task任务的执行状态

func NewTaskCondition

func NewTaskCondition(rsName string) *TaskCondition

NewTaskCondition 创建一个NewTaskCondition

Directories

Path Synopsis
Package mock_healthcheck is a generated GoMock package.
Package mock_healthcheck is a generated GoMock package.

Jump to

Keyboard shortcuts

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