Documentation
¶
Overview ¶
Package obs provides the local observability HTTP server for sqi-worker.
The server is intentionally minimal and listens on a loopback address (default 127.0.0.1:9091) so it is accessible to local monitoring agents and container orchestrators without being reachable from the network.
Endpoints ¶
- GET /healthz — liveness probe; always 200 while the HTTP event loop runs.
- GET /readyz — readiness probe; 200 when all registered [health.Checker]s pass, 503 when any fail (e.g. NATS connection is down).
- GET /metrics — Prometheus text/OpenMetrics exposition.
- GET /debug/pprof/* — Go runtime profiling (only when pprof is enabled).
Usage ¶
srv := obs.New(cfg, logger, metrics, health) go srv.Run(ctx) // starts listening; returns when ctx is canceled // ... after work is done ... srv.Shutdown(ctx) // graceful stop
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the local observability HTTP server for sqi-worker. Create with New; start with [Run]; stop with [Shutdown].
func New ¶
func New( addr string, enablePprof bool, logger *slog.Logger, m *workmetrics.Metrics, h *health.Registry, ) *Server
New creates a *Server with the given configuration.
- addr — TCP listen address, e.g. "127.0.0.1:9091"
- enablePprof — when true, registers /debug/pprof/* endpoints
- logger — used for request logging and startup/shutdown messages
- m — worker Prometheus metrics; /metrics serves this registry
- h — health registry consulted by /readyz
Click to show internal directories.
Click to hide internal directories.