watch

package
v0.0.0-...-8223eb1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const HEALTHCHECK_INTERVAL = 1 * time.Second

Duration between health checks

Variables

This section is empty.

Functions

func MonitorPodHealth

func MonitorPodHealth(config *preparer.PreparerConfig, logger *logging.Logger, shutdownCh chan struct{})

MonitorPodHealth is meant to be a long running go routine. MonitorPodHealth reads from a consul store to determine which services should be running on the host. MonitorPodHealth runs a CheckHealth routine to monitor the health of each service and kills routines for services that should no longer be running.

Types

type PodWatch

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

PodWatch houses a pod's manifest, a channel to kill the pod's goroutine if the pod is removed from the reality tree, and a bool that indicates whether or not the pod has a running MonitorHealth go routine

func (*PodWatch) MonitorHealth

func (p *PodWatch) MonitorHealth()

Monitor Health is a go routine that runs as long as the service it is monitoring. Every HEALTHCHECK_INTERVAL it performs a health check and writes that information to consul

type StatusChecker

type StatusChecker struct {
	ID     types.PodID
	Node   types.NodeName
	URI    string
	Client *http.Client
}

StatusChecker holds all the data required to perform a status check on a particular service

func (*StatusChecker) Check

func (sc *StatusChecker) Check() (health.Result, error)

Given the result of a status check this method creates a health.Result for that node/service/result

func (*StatusChecker) StatusCheck

func (sc *StatusChecker) StatusCheck() (*http.Response, error)

Go version of http status check

Jump to

Keyboard shortcuts

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