health

package
v0.0.0-...-ad1a918 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2014 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReplicationLag should be the key for any reporters
	// reporting MySQL repliaction lag.
	ReplicationLag = "replication_lag"

	// ReplicationLagHigh should be the value for any reporters
	// indicating that the replication lag is too high.
	ReplicationLagHigh = "high"
)
View Source
const (
	Healthy   = "healthy"
	Unhappy   = "unhappy"
	Unhealthy = "unhealthy"
	Unknown   = "unknown"
)

Variables

This section is empty.

Functions

func History

func History() []interface{}

History returns the health records from the default health aggregator.

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(typ topo.TabletType) (map[string]string, error)

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

Types

type Aggregator

type Aggregator struct {
	History *history.History
	// contains filtered or unexported fields
}

Aggregator aggregates the results of many Reporters.

func NewAggregator

func NewAggregator() *Aggregator

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(typ topo.TabletType) (map[string]string, error)

Run runs 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.

type FunctionReporter

type FunctionReporter func(typ topo.TabletType) (map[string]string, error)

FunctionReporter is a function that may act as a Reporter.

func (FunctionReporter) Report

func (fc FunctionReporter) Report(typ topo.TabletType) (status map[string]string, err error)

type Record

type Record struct {
	Error  error
	Result map[string]string
	Time   time.Time
}

Record records one run of an aggregator.

func (Record) Class

func (r Record) Class() string

func (Record) IsDuplicate

func (r Record) IsDuplicate(other interface{}) bool

type Reporter

type Reporter interface {
	// Report returns a map of health states for the tablet
	// assuming that its tablet type is typ. If Report returns an
	// error it implies that the tablet is in a bad shape and not
	// able to handle queries.
	Report(typ topo.TabletType) (status map[string]string, err error)
}

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