Files
web/health/doc.go
T
Rene Nochebuena 311e92cfc6 docs(web): fix non-compiling doc examples; bump to v1.1.0
Coordinated framework release. Documentation-only code changes plus the shared
version bump (folds the never-tagged 1.0.1 contracts pin into 1.1.0).

- mw.Recover() -> mw.Recover(logger): web/mw/doc.go, web/server/doc.go,
  web/server/server.go.
- health.NewHandler(...) -> ....ServeHTTP (chi Get takes HandlerFunc): web/server/doc.go,
  web/doc.go, web/health/doc.go.
- go.mod: contracts, core -> v1.1.0 (via go get + go mod tidy).

Verified by compiling the example patterns against the real API. Badge -> v1.1.0.
2026-08-07 18:53:42 -06:00

24 lines
863 B
Go

// Package health provides a concurrent health check HTTP handler.
//
// The handler runs all registered checks in parallel, collects results within
// a configurable timeout, and returns a structured JSON response. It maps
// directly onto Kubernetes liveness and readiness probes.
//
// Components register themselves by implementing
// [observability.Checkable] from einherjar/contracts — no adapter needed.
//
// - [observability.LevelCritical]: if DOWN, overall status is DOWN (503)
// - [observability.LevelDegraded]: if DOWN, overall status is DEGRADED (200)
//
// # Example
//
// srv.Get("/health", health.NewHandler(logger, db, cache, storage).ServeHTTP)
//
// Or with custom timeout:
//
// srv.Get("/health", health.NewHandlerWithConfig(logger,
// health.Config{CheckTimeout: 3 * time.Second},
// db, cache,
// ).ServeHTTP)
package health