Documentation
¶
Overview ¶
Package health exposes a small HTTP server with /health (liveness) and /ready (readiness) endpoints so that operators and orchestrators can monitor a running pgstream process.
Index ¶
Constants ¶
const (
DefaultAddress = "localhost:9910"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Server)
func WithLogger ¶
func WithReadinessCheck ¶
WithReadinessCheck registers a function the /ready handler will invoke. The function is given a context with a short timeout; returning a non-nil error causes /ready to respond with 503. If no check is registered, /ready behaves like /health.
func WithVersion ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves /health and /ready over HTTP.
func NewServer ¶
NewServer builds a health server from the given config. The server is not started until Start() is called.
func (*Server) Listen ¶
Listen binds the configured address synchronously and prepares the HTTP server. After it returns successfully, Serve must be called (typically from a goroutine) to start accepting requests. Splitting bind from serve lets callers surface bind errors synchronously and ensures Shutdown always observes an initialised server.