Documentation
¶
Overview ¶
Package healthkit provides liveness and readiness reporting for uber/fx applications. It is designed for use with container orchestrators and load balancers like Kubernetes.
Two integration modes are supported:
- Dedicated server (Module): starts its own HTTP server on a configurable port. This is the recommended approach as it isolates health checks from application traffic.
- Mux attachment (MuxModule): attaches a /health handler to an existing *http.ServeMux provided by the application. Useful if you already run an HTTP server and want to avoid a second port.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MuxModule ¶
MuxModule provides health reporting attached to an existing *http.ServeMux. It includes the core Health service and invokes a handler registration.
func RegisterMux ¶
RegisterMux attaches the health handler to a Mux provided in the Fx container. This is used by MuxModule().
func RegisterServer ¶
RegisterServer creates a dedicated HTTP server and registers it with the application lifecycle. This is used by ServerModule().
func ServerModule ¶
ServerModule provides a self-contained health server on a dedicated port. It includes the core Health service and invokes a dedicated HTTP server.
Types ¶
type Config ¶
type Config struct {
// Port is the network address for the dedicated health server.
// Defaults to ":8081" if not set.
// Only used by ServerModule(), ignored by MuxModule().
Port string `yaml:"port"`
// StartupDelay is the duration to wait after the application has started
// before reporting readiness. Defaults to 200ms if not set.
StartupDelay time.Duration `yaml:"startup_delay"`
}
Config defines configuration for the Health service.