circuitbreaker

package
v0.0.0-...-9625d7e Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FirstTripType uint = iota
	SecondTripType
)
View Source
const (
	TimeDefaultLayout           = "2006-01-02 15:04:05.999999999 -0700 MST"
	AgentCircuitBreakerFileName = "cesAgentCircuitBreaker"
	AgentPIDFileName            = "cesAgent.pid"
	CBCheckIntervalInSecond     = 60
	TripCountFor1stThreshold    = 3
	TripCheckWindowInSecond     = (TripCountFor1stThreshold-1)*CBCheckIntervalInSecond + 11 // 11 just for tolerance
	SleepCheckCount             = 3
	SleepCheckWindowInSecond    = (SleepCheckCount + 1) * TripCountFor1stThreshold * CBCheckIntervalInSecond
	SleepTimeInSecond           = 20 * 60
	CBMaxSizeInBytes            = 1024
)

Variables

This section is empty.

Functions

func DelFile

func DelFile()

DelFile

func IsSleepNeeded

func IsSleepNeeded() bool

IsSleepNeeded

func SingleInstanceCheck

func SingleInstanceCheck() (err error)

SingleInstanceCheck check whether the agent process is running before start error indicates there is another agent process is running or sth. wrong to check

func Sleep

func Sleep()

func Start

func Start()

Start

Types

type CircuitBreaker

type CircuitBreaker struct {
	//consecutiveFailures uint
	StateList *list.List
}

CircuitBreaker

type Record

type Record struct {
	Time       string  `json:"time"`
	PID        int     `json:"pid"`
	CPUPercent float64 `json:"cpu_percent"`
	Memory     uint64  `json:"memory"`
	TripType   uint    `json:"trip_type"`
}

Record is one item/row in record file

func (*Record) String

func (r *Record) String() string

type State

type State struct {
	CPUPct float64
	Memory uint64
	Time   time.Time
}

State represents the state of cb

func (*State) String

func (s *State) String() string

Jump to

Keyboard shortcuts

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