health

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwaitAlive

func AwaitAlive(ctx context.Context, c *Client, freq time.Duration, tags []string, options ...rpc.Option) (bool, error)

AwaitAlive polls the node every [freq] until the node reports liveness. Only returns an error if [ctx] returns an error.

func AwaitHealthy

func AwaitHealthy(ctx context.Context, c *Client, freq time.Duration, tags []string, options ...rpc.Option) (bool, error)

AwaitHealthy polls the node every [freq] until the node reports healthy. Only returns an error if [ctx] returns an error.

func AwaitReady

func AwaitReady(ctx context.Context, c *Client, freq time.Duration, tags []string, options ...rpc.Option) (bool, error)

AwaitReady polls the node every [freq] until the node reports ready. Only returns an error if [ctx] returns an error.

Types

type APIArgs

type APIArgs struct {
	Tags []string `json:"tags"`
}

APIArgs is the arguments for Readiness, Health, and Liveness.

type APIReply

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

APIReply is the response for Readiness, Health, and Liveness.

type Client

type Client struct {
	Requester rpc.EndpointRequester
}

func NewClient

func NewClient(uri string) *Client

func (*Client) Health

func (c *Client) Health(ctx context.Context, tags []string, options ...rpc.Option) (*APIReply, error)

Health returns a summation of the health of the node

func (*Client) Liveness

func (c *Client) Liveness(ctx context.Context, tags []string, options ...rpc.Option) (*APIReply, error)

Liveness returns if the node is in need of a restart

func (*Client) Readiness

func (c *Client) Readiness(ctx context.Context, tags []string, options ...rpc.Option) (*APIReply, error)

Readiness returns if the node has finished initialization

type Result

type Result struct {
	// Details of the HealthCheck.
	Details interface{} `json:"message,omitempty"`

	// Error is the string representation of the error returned by the failing
	// HealthCheck. The value is nil if the check passed.
	Error *string `json:"error,omitempty"`

	// Timestamp of the last HealthCheck.
	Timestamp time.Time `json:"timestamp,omitempty"`

	// Duration is the amount of time this HealthCheck last took to evaluate.
	Duration time.Duration `json:"duration"`

	// ContiguousFailures the HealthCheck has returned.
	ContiguousFailures int64 `json:"contiguousFailures,omitempty"`

	// TimeOfFirstFailure of the HealthCheck,
	TimeOfFirstFailure *time.Time `json:"timeOfFirstFailure,omitempty"`
}

Result describes a single health check outcome.

Jump to

Keyboard shortcuts

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