Documentation
¶
Overview ¶
Package health exposes a small HTTP server with /health (liveness), /ready (readiness), and /status (pipeline phase) 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 ¶
WithLogger sets the logger the health server uses, tagged with the health_server module field.
func WithPhaseProvider ¶ added in v1.2.1
WithPhaseProvider registers a function the /status handler will invoke to report the current pipeline phase (e.g. "snapshot" or "replication"). If no provider is registered, /status still returns status/version with an empty phase.
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 ¶
WithVersion sets the version string the health server reports.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves /health, /ready, and /status 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.