go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/health Index | Files

package health

import "gopkg.in/src-d/go-vitess.v1/vt/health"

Index

Package Files

health.go

type Aggregator Uses

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

Aggregator aggregates the results of many Reporters. It also implements the Reporter interface.

var (
    // DefaultAggregator is the global aggregator to use for real
    // programs. Use a custom one for tests.
    DefaultAggregator *Aggregator

    // ErrSlaveNotRunning is returned by health plugins when replication
    // is not running and we can't figure out the replication delay.
    // Note everything else should be operational, and the underlying
    // MySQL instance should be capable of answering queries.
    ErrSlaveNotRunning = errors.New("slave is not running")
)

func NewAggregator Uses

func NewAggregator() *Aggregator

NewAggregator returns a new empty Aggregator

func (*Aggregator) HTMLName Uses

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

HTMLName returns an aggregate name for all the reporters

func (*Aggregator) Register Uses

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

Register registers rep with ag.

func (*Aggregator) RegisterSimpleCheck Uses

func (ag *Aggregator) RegisterSimpleCheck(name string, check func() error)

RegisterSimpleCheck registers a simple health check function.

func (*Aggregator) Report Uses

func (ag *Aggregator) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error)

Report 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 Uses

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

FunctionReporter is a function that may act as a Reporter.

func (FunctionReporter) HTMLName Uses

func (fc FunctionReporter) HTMLName() template.HTML

HTMLName implements Reporter.HTMLName

func (FunctionReporter) Report Uses

func (fc FunctionReporter) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error)

Report implements Reporter.Report

type Reporter Uses

type Reporter interface {
    // Report returns the replication delay gathered by this
    // module (or 0 if it thinks it's not behind), assuming that
    // it is a slave type or not, 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(isSlaveType, 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.

Package health imports 7 packages (graph) and is imported by 3 packages. Updated 2019-06-13. Refresh now. Tools for package owners.