feat(v2/httpserver): Add HTTP server with built-in health probes
Context
Part of the LabKit v2 package decomposition from the UAM PoC (!314).
Tracking issue: gitlab-org/quality/quality-engineering/team-tasks#4283 (closed) Parent epic: gitlab-org/quality#360
What's in this MR?
-
v2/httpserverpackage: production-ready HTTP server implementingapp.Component- Abstract
Routerinterface backed by chi internally, with no framework types in the public API - Method-specific route registration:
Get,Post,Put,Delete,Patch - Route grouping with scoped middleware via
GroupandRoute - Per-route middleware via
With - Sub-router mounting via
Mount - Path parameter extraction via
URLParam - Custom
NotFoundandMethodNotAllowedhandlers - Custom
Routerinjection viahttpserver.Configfor alternative implementations - All middleware uses the standard
func(http.Handler) http.Handlersignature - Automatic
/-/livenessand/-/readinessendpoints (handled by Server directly) - Chainable readiness checks that run concurrently
- Built-in request tracing (with low-cardinality span names from route patterns) and logging middleware
- Configurable graceful shutdown with timeout
- Compile-time
app.Componentassertion
- Abstract
Dependencies
Depends on !337 (merged) (v2/app package).
Proof of Work
ok gitlab.com/gitlab-org/labkit/v2/httpserver 0.503s
30 tests covering: route registration (Handle, HandleFunc, method-specific), middleware (Use, With, Group), route grouping (Group, Route), mounting, URL parameters, custom error handlers, 404 behavior, custom router injection, lifecycle (Start/Shutdown, port binding, bad address), tracing (span creation, route pattern names, 5xx errors, W3C context propagation), logging, and health checks (liveness, readiness with passing/failing checks, content type, chaining).
Related
- gitlab-org/quality/quality-engineering/team-tasks#4283 (closed) (design requirements)
- gitlab-org/quality/quality-engineering/team-tasks#4294 (closed) (router investigation)
- gitlab-org/quality/quality-engineering/team-tasks#4311 (Chi adoption discussion)
Edited by Doug Barrett