health

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHealthArgs

type APIHealthArgs struct{}

APIHealthArgs are the arguments for Health

type APIHealthClientReply added in v0.2.3

type APIHealthClientReply struct {
	Checks  map[string]Result `json:"checks"`
	Healthy bool              `json:"healthy"`
}

type APIHealthServerReply added in v0.2.3

type APIHealthServerReply struct {
	Checks  map[string]healthback.Result `json:"checks"`
	Healthy bool                         `json:"healthy"`
}

APIHealthReply is the response for Health

type Client

type Client interface {
	// Health returns a health check on the Avalanche node
	Health() (*APIHealthClientReply, error)
	// AwaitHealthy queries the Health endpoint [checks] times, with a pause of
	// [interval] in between checks and returns early if Health returns healthy
	AwaitHealthy(numChecks int, freq time.Duration) (bool, error)
}

Client interface for Avalanche Health API Endpoint

func NewClient

func NewClient(uri string, requestTimeout time.Duration) Client

NewClient returns a client to interact with Health API endpoint

type ErrorMsg added in v0.2.3

type ErrorMsg struct {
	Message string `json:"message"`
}

type Health added in v0.4.0

type Health interface {
	healthlib.Service

	Handler() (*common.HTTPHandler, error)
}

Health wraps a healthlib.Service. Handler() returns a handler that handles incoming HTTP API requests. We have this in a separate package from healthlib to avoid a circular import where this service imports snow/engine/common but that package imports healthlib.Checkable

func New added in v0.4.0

func New(checkFreq time.Duration, log logging.Logger, namespace string, registry prometheus.Registerer) (Health, error)

func NewNoOp added in v0.4.0

func NewNoOp() Health

NewNoOp returns a noop version of the health interface that does nothing for when the Health API is disabled

type Result added in v0.2.3

type Result struct {
	// the details of task Result - may be nil
	Details interface{} `json:"message,omitempty"`
	// the error returned from a failed health check - an empty string when successful
	Error ErrorMsg `json:"error,omitempty"`
	// the time of the last health check
	Timestamp time.Time `json:"timestamp"`
	// the execution duration of the last check
	Duration time.Duration `json:"duration,omitempty"`
	// the number of failures that occurred in a row
	ContiguousFailures int64 `json:"contiguousFailures"`
	// the time of the initial transitional failure
	TimeOfFirstFailure *time.Time `json:"timeOfFirstFailure"`
}

Result represents the output of a health check execution.

type Service

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

func (*Service) Health added in v0.4.0

func (s *Service) Health(_ *http.Request, _ *APIHealthArgs, reply *APIHealthServerReply) error

Health returns a summation of the health of the node

Jump to

Keyboard shortcuts

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