health

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package health adds liveness and readiness endpoints to a Tern app:

ternApp(kit.WithPlugins(health.New(
	health.Check("database", db.PingContext),
)))

GET /healthz reports that the process is up. GET /readyz runs every check and reports 503 if one fails, or while the app is shutting down, so a load balancer stops sending traffic before the server stops.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckFunc

type CheckFunc func(ctx context.Context) error

CheckFunc reports whether a dependency is usable.

type Option

type Option func(*Plugin)

Option configures the plugin.

func Check

func Check(name string, fn CheckFunc) Option

Check adds a readiness check.

func Paths

func Paths(live, ready string) Option

Paths changes the endpoints from /healthz and /readyz.

func Timeout

func Timeout(d time.Duration) Option

Timeout bounds all checks together. The default is 5 seconds.

type Plugin

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

Plugin serves the health endpoints. Create it with New.

func New

func New(opts ...Option) *Plugin

New returns the health plugin.

func (*Plugin) Name

func (*Plugin) Name() string

Name implements kit.Plugin.

func (*Plugin) Setup

func (p *Plugin) Setup(s *kit.Setup) error

Setup implements kit.Plugin.

Jump to

Keyboard shortcuts

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