health

package
v0.0.0-...-bc668d9 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2015 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTMLName

func HTMLName() template.HTML

HTMLName returns an aggregate name for the default reporter

func Register

func Register(name string, rep Reporter)

Register registers rep under name with the default health aggregator. Only keys specified in keys will be aggregated from this particular Reporter.

func Run

func Run(tabletType topo.TabletType, shouldQueryServiceBeRunning bool) (time.Duration, error)

Run collects all the health statuses from the default health aggregator.

Types

type Aggregator

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

Aggregator aggregates the results of many Reporters.

func NewAggregator

func NewAggregator() *Aggregator

NewAggregator returns a new empty Aggregator

func (*Aggregator) HTMLName

func (ag *Aggregator) HTMLName() template.HTML

HTMLName returns an aggregate name for all the reporters

func (*Aggregator) Register

func (ag *Aggregator) Register(name string, rep Reporter)

Register registers rep with ag. Only keys specified in keys will be aggregated from this particular Reporter.

func (*Aggregator) Run

func (ag *Aggregator) Run(tabletType topo.TabletType, shouldQueryServiceBeRunning bool) (time.Duration, error)

Run aggregates health statuses from all the reporters. If any errors occur during the reporting, they will be logged, but only the first error will be returned. The returned replication delay will be the highest of all the replication delays returned by the Reporter implementations (although typically only one implementation will actually return a meaningful one).

type FunctionReporter

type FunctionReporter func(topo.TabletType, bool) (time.Duration, error)

FunctionReporter is a function that may act as a Reporter.

func (FunctionReporter) HTMLName

func (fc FunctionReporter) HTMLName() template.HTML

HTMLName implements Reporter.HTMLName

func (FunctionReporter) Report

func (fc FunctionReporter) Report(tabletType topo.TabletType, shouldQueryServiceBeRunning bool) (time.Duration, error)

Report implements Reporter.Report

type Reporter

type Reporter interface {
	// Report returns the replication delay gathered by this
	// module (or 0 if it thinks it's not behind), assuming that
	// its tablet type is TabletType, and that its query service
	// should be running or not. If Report returns an error it
	// implies that the tablet is in a bad shape and not able to
	// handle queries.
	Report(tabletType topo.TabletType, shouldQueryServiceBeRunning bool) (replicationDelay time.Duration, err error)

	// HTMLName returns a displayable name for the module.
	// Can be used to be displayed in the status page.
	HTMLName() template.HTML
}

Reporter reports the health status of a tablet.

Jump to

Keyboard shortcuts

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