allochealth

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MPL-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// AllocHealthEventSource is the source used for emitting task events
	AllocHealthEventSource = "Alloc Unhealthy"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracker

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

Tracker tracks the health of an allocation and makes health events watchable via channels.

func NewTracker

func NewTracker(parentCtx context.Context, logger hclog.Logger, alloc *structs.Allocation,
	allocUpdates *cstructs.AllocListener, consulClient cconsul.ConsulServiceAPI,
	minHealthyTime time.Duration, useChecks bool) *Tracker

NewTracker returns a health tracker for the given allocation. An alloc listener and consul API object are given so that the watcher can detect health changes.

func (*Tracker) AllocStoppedCh

func (t *Tracker) AllocStoppedCh() <-chan struct{}

AllocStoppedCh returns a channel that will be fired if the allocation is stopped. This means that health will not be set.

func (*Tracker) HealthyCh

func (t *Tracker) HealthyCh() <-chan bool

HealthyCh returns a channel that will emit a boolean indicating the health of the allocation.

func (*Tracker) Start

func (t *Tracker) Start()

Start starts the watcher.

func (*Tracker) TaskEvents

func (t *Tracker) TaskEvents() map[string]*structs.TaskEvent

TaskEvents returns a map of events by task. This should only be called after health has been determined. Only tasks that have contributed to the allocation being unhealthy will have an event.

Jump to

Keyboard shortcuts

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