health

package
v0.0.0-...-70e7a0d Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	// Liveness returns a handler that returns 200 OK if the server is alive (running).
	Liveness() http.HandlerFunc

	// Readiness returns a handler that returns 200 OK if the server is ready to accept traffic
	// and 503 Service Unavailable if the server is not ready to serve traffic.
	Readiness() http.HandlerFunc

	// SetReady should automatically be set to true when the server is ready to accept traffic.
	SetReady(isReady bool)
}

Checker defines an interface that must be implemented by a health checker to determine if the router can currently accept traffic.

type Checks

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

func New

func New(opts *Options) *Checks

func (*Checks) Liveness

func (c *Checks) Liveness() http.HandlerFunc

Liveness returns a handler that returns 200 OK if the server is alive (running).

func (*Checks) Readiness

func (c *Checks) Readiness() http.HandlerFunc

Readiness returns a handler that returns 200 OK if the server is ready to accept traffic and 503 Service Unavailable if the server is not ready to serve traffic.

func (*Checks) SetReady

func (c *Checks) SetReady(isReady bool)

SetReady sets the readiness state to the given value

type Options

type Options struct {
	Logger *zap.Logger
}

Jump to

Keyboard shortcuts

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