ps_healthcheck

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ps_healthcheck exposes the standard k8s probes (/healthz, /readyz, /startupz) on an HTTP mux. /healthz is liveness — always 200 while the process is up. /readyz runs caller-supplied probes (Mongo / Redis pings) and returns 503 if any probe fails; this is what k8s should be wired to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(mux *http.ServeMux, opt *Options)

Register installs the standard probes on mux. For deployments without dependency probes, pass an empty Options{} — readyz then trivially returns 200.

Types

type Options

type Options struct {
	Probes       map[string]Probe
	StartupReady *atomic.Bool
	DrainingCtx  context.Context
}

Options configures Register. Probes is a name→check map; the readyz handler fans out and reports the first failure. StartupReady toggles /startupz from 503 to 200 when set; if nil, /startupz mirrors /healthz. Draining, when set and true, forces /readyz to 503 without running probes — this is the lame-duck signal flipped on SIGTERM so k8s pulls the pod out of the load balancer before the servers shut down.

type Probe

type Probe func(ctx context.Context) error

Probe is a readiness check. It must respect ctx and return quickly (typically well under the readyzTimeout below).

Jump to

Keyboard shortcuts

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