Documentation ¶
Index ¶
- Constants
- type Checker
- func NewCommandChecker(cmd string, endpoint string, mechanism *TimeMechanism) (Checker, error)
- func NewHTTPChecker(container, schema string, port int, path string, mechanism *TimeMechanism, ...) (Checker, error)
- func NewTCPChecker(container string, port int, mechanism *TimeMechanism, notify FailureNotify) (Checker, error)
- type CheckerStat
- func (check *CheckerStat) ConsecutiveFailure() int
- func (check *CheckerStat) Failure() int
- func (check *CheckerStat) IsHealthy() bool
- func (check *CheckerStat) IsTicks() bool
- func (check *CheckerStat) LastCheckTime() time.Time
- func (check *CheckerStat) LastFailureTime() time.Time
- func (check *CheckerStat) TotalTicks() int
- type CommandChecker
- func (check *CommandChecker) IsStarting() bool
- func (check *CommandChecker) Name() string
- func (check *CommandChecker) Pause() error
- func (check *CommandChecker) ReCheck() bool
- func (check *CommandChecker) Relation() string
- func (check *CommandChecker) Resume() error
- func (check *CommandChecker) SetHost(containerid string)
- func (check *CommandChecker) Start()
- func (check *CommandChecker) Stop()
- type FailureNotify
- type HTTPChecker
- func (check *HTTPChecker) IsStarting() bool
- func (check *HTTPChecker) Name() string
- func (check *HTTPChecker) Pause() error
- func (check *HTTPChecker) ReCheck() bool
- func (check *HTTPChecker) Relation() string
- func (check *HTTPChecker) Resume() error
- func (check *HTTPChecker) SetHost(host string)
- func (check *HTTPChecker) Start()
- func (check *HTTPChecker) Stop()
- type TCPChecker
- func (check *TCPChecker) IsStarting() bool
- func (check *TCPChecker) Name() string
- func (check *TCPChecker) Pause() error
- func (check *TCPChecker) ReCheck() bool
- func (check *TCPChecker) Relation() string
- func (check *TCPChecker) Resume() error
- func (check *TCPChecker) SetHost(host string)
- func (check *TCPChecker) Start()
- func (check *TCPChecker) Stop()
- type TimeMechanism
Constants ¶
const ( HttpHealthcheck = "http" TcpHealthcheck = "tcp" CommandHealthcheck = "command" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker interface { IsStarting() bool //checker is running SetHost(host string) //setting ip/host for checker IsHealthy() bool //get if check is healthy TotalTicks() int //total check ticks IsTicks() bool // is health check ConsecutiveFailure() int //get consecutive failure times Failure() int //total failures LastFailureTime() time.Time //last Failure LastCheckTime() time.Time //last check tick Start() //start checker Stop() //stop checker ReCheck() bool //ask checker to check Pause() error //pause check Resume() error //arouse checker Name() string //checker name Relation() string //checker relative to container }
Checker health check interface
func NewCommandChecker ¶
func NewCommandChecker(cmd string, endpoint string, mechanism *TimeMechanism) (Checker, error)
NewCommandChecker create http checker
func NewHTTPChecker ¶
func NewHTTPChecker(container, schema string, port int, path string, mechanism *TimeMechanism, notify FailureNotify) (Checker, error)
NewHTTPChecker create http checker
func NewTCPChecker ¶
func NewTCPChecker(container string, port int, mechanism *TimeMechanism, notify FailureNotify) (Checker, error)
NewTCPChecker create TCP checker
type CheckerStat ¶
type CheckerStat struct { Started bool //status for started StartPoint time.Time //starting time LastFailure time.Time //time record LastCheck time.Time //time record Failures int //amount of failure Ticks int //total checks ConsecutiveFailures int //failure Healthy bool //healthy status }
CheckerStat checker statistic
func (*CheckerStat) ConsecutiveFailure ¶
func (check *CheckerStat) ConsecutiveFailure() int
ConsecutiveFailure get consecutive failure times
func (*CheckerStat) IsHealthy ¶
func (check *CheckerStat) IsHealthy() bool
IsHealthy get if check is healthy
func (*CheckerStat) IsTicks ¶
func (check *CheckerStat) IsTicks() bool
func (*CheckerStat) LastCheckTime ¶
func (check *CheckerStat) LastCheckTime() time.Time
LastCheckTime last check tick
func (*CheckerStat) LastFailureTime ¶
func (check *CheckerStat) LastFailureTime() time.Time
LastFailureTime last Failure
func (*CheckerStat) TotalTicks ¶
func (check *CheckerStat) TotalTicks() int
TotalTicks total check ticks
type CommandChecker ¶
type CommandChecker struct { CheckerStat // contains filtered or unexported fields }
CommandChecker check for http protocol health check
func (*CommandChecker) IsStarting ¶
func (check *CommandChecker) IsStarting() bool
func (*CommandChecker) ReCheck ¶
func (check *CommandChecker) ReCheck() bool
ReCheck ask checker to check
func (*CommandChecker) Relation ¶
func (check *CommandChecker) Relation() string
Relation checker relative to container
func (*CommandChecker) SetHost ¶
func (check *CommandChecker) SetHost(containerid string)
SetHost setting container_id
type HTTPChecker ¶
type HTTPChecker struct { CheckerStat // contains filtered or unexported fields }
HTTPChecker check for http protocol health check
func (*HTTPChecker) IsStarting ¶
func (check *HTTPChecker) IsStarting() bool
func (*HTTPChecker) Relation ¶
func (check *HTTPChecker) Relation() string
Relation checker relative to container
func (*HTTPChecker) SetHost ¶
func (check *HTTPChecker) SetHost(host string)
SetHost setting host / ipaddress
type TCPChecker ¶
type TCPChecker struct { CheckerStat // contains filtered or unexported fields }
TCPChecker create check for tcp port check
func (*TCPChecker) IsStarting ¶
func (check *TCPChecker) IsStarting() bool
func (*TCPChecker) Relation ¶
func (check *TCPChecker) Relation() string
Relation checker relative to container
func (*TCPChecker) SetHost ¶
func (check *TCPChecker) SetHost(host string)
SetHost setting host / ipaddress
func (*TCPChecker) Start ¶
func (check *TCPChecker) Start()
Start start checker, must running in indivisual goroutine
type TimeMechanism ¶
type TimeMechanism struct { //DelaySeconds int // Amount of time to wait until starting the health checks. IntervalSeconds int // Interval between health checks. TimeoutSeconds int // Amount of time to wait for the health check to complete. ConsecutiveFailures int // Number of consecutive failures until signaling kill task. GracePeriodSeconds int // Amount of time to allow failed health checks since launch. }
TimeMechanism item for checker