Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPCheck ¶
type HTTPCheck struct {
// URL is the URL that will be requested
URL string
// Host specifies the host to be used in the Host header as well as the TLS
// SNI extension. It is optional, if unset the host from the URL will be
// used.
Host string
Timeout time.Duration
// The response must respond with StatusCode for the check to pass. It
// defaults to 200.
StatusCode int
// If set, MatchBytes must be a subset present in the first 5120 bytes of
// the response for the check to pass.
MatchBytes []byte
}
type Monitor ¶
type Monitor struct {
// StartInterval is the check interval to use when waiting for the service
// to transition from created -> up. It defaults to 100ms.
StartInterval time.Duration
// Interval is the check interval to use when the service is up or down. It
// defaults to two seconds.
Interval time.Duration
// Threshold is the number of consecutive checks of the same status before
// a service will transition up -> down or down -> up. It defaults to 2.
Threshold int
// Logger is the logger that will be used to emit messages for each
// transition and for each failed check. If it is nil, no messages will be
// logged.
Logger log15.Logger
}
type MonitorEvent ¶
type MonitorEvent struct {
Status MonitorStatus
// If Status is MonitorStatusDown, Err is the last failure
Err error
// Check is included to identify the monitor.
Check Check
}
type MonitorStatus ¶
type MonitorStatus int
const ( MonitorStatusUnknown MonitorStatus = iota MonitorStatusCreated MonitorStatusUp MonitorStatusDown )
func (MonitorStatus) String ¶
func (m MonitorStatus) String() string
type Registration ¶
type Registration struct {
Registrar Registrar
Service string
Instance *discoverd.Instance
Monitor func(Check, chan MonitorEvent) stream.Stream
Check Check
Events chan MonitorEvent
Logger log15.Logger
}
func (*Registration) Register ¶
func (r *Registration) Register() discoverd.Heartbeater
Click to show internal directories.
Click to hide internal directories.