healthcheck

package
v2.0.0-...-111f97f Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLivenessEndpoint  = "/livez"
	DefaultReadinessEndpoint = "/readyz"
)

Variables

View Source
var ConfigDefault = Config{
	LivenessProbe:     defaultLivenessProbe,
	ReadinessProbe:    defaultReadinessProbe,
	LivenessEndpoint:  DefaultLivenessEndpoint,
	ReadinessEndpoint: DefaultReadinessEndpoint,
}

ConfigDefault is the default config

Functions

func New

func New(config ...Config) fiber.Handler

Types

type Config

type Config struct {
	// Next defines a function to skip this middleware when returned true.
	//
	// Optional. Default: nil
	Next func(c *fiber.Ctx) bool

	// Function used for checking the liveness of the application. Returns true if the application
	// is running and false if it is not. The liveness probe is typically used to indicate if
	// the application is in a state where it can handle requests (e.g., the server is up and running).
	//
	// Optional. Default: func(c *fiber.Ctx) bool { return true }
	LivenessProbe HealthChecker

	// HTTP endpoint at which the liveness probe will be available.
	//
	// Optional. Default: "/livez"
	LivenessEndpoint string

	// Function used for checking the readiness of the application. Returns true if the application
	// is ready to process requests and false otherwise. The readiness probe typically checks if all necessary
	// services, databases, and other dependencies are available for the application to function correctly.
	//
	// Optional. Default: func(c *fiber.Ctx) bool { return true }
	ReadinessProbe HealthChecker

	// HTTP endpoint at which the readiness probe will be available.
	// Optional. Default: "/readyz"
	ReadinessEndpoint string
}

Config defines the configuration options for the healthcheck middleware.

type HealthChecker

type HealthChecker func(*fiber.Ctx) bool

HealthChecker defines a function to check liveness or readiness of the application

type HealthCheckerHandler

type HealthCheckerHandler func(HealthChecker) fiber.Handler

ProbeCheckerHandler defines a function that returns a ProbeChecker

Jump to

Keyboard shortcuts

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