Establish LabKit v2 Module
## Goal Establish LabKit v2 as a modern Go module alongside the existing v1, providing a clean foundation for new platform capabilities built on OpenTelemetry, slog, and composable app lifecycle management. ## What we did 1. **v2 module created** as a separate Go module (`gitlab.com/gitlab-org/labkit/v2`) coexisting with v1 in the same repository. v1 remains on master for backward compatibility. 1. **Architecture established**: component-based lifecycle via `app.App`, dependency-injected config, zero global state, mandatory context propagation, and `sync.Once` lazy init. 1. **Core packages shipped**: - `v2/app` -- Application lifecycle coordinator (merged) - `v2/secret` -- Swappable secret provider with redacting Secret type (merged, released v1.45.0) - `v2/httpclient` -- Outbound HTTP client with tracing and retry (merged) - `v2/log` -- Structured slog helpers and field definitions (merged) - `v2/correlation` -- Correlation ID propagation via context (merged) - `v2/trace` -- OpenTelemetry tracing abstraction (merged) - `v2/fields` -- Standardized log field constants (merged) 1. **Packages in review**: - `v2/http` -- HTTP AccessLogger middleware with slog (!316) - `v2/postgres` -- Instrumented PostgreSQL client with query tracing (!340) - `v2/httpserver` -- HTTP server with health probes and Chi router (!339) - `v2/featureflag` -- OpenFeature client with OTel tracing (!342, on hold) 1. **Developer guardrails**: depguard rules preventing v1 imports in v2 code, AGENTS.md with architectural guidelines for AI-assisted review. ## Outcome The v2 module is established with a stable architecture and a growing set of production-ready packages. Ongoing package delivery continues under the [UAM LabKit Follow-up Work](https://gitlab.com/groups/gitlab-org/quality/-/epics/360) epic. ## Participants - DRI: @d.barrett - Reviewer: @e_forbes <details> <summary>Original description</summary> If we ever would release v2 of LabKit, this issue lists what we'd like to fix (i.e. breaking changes). - `tracing/grpc` and `correlation/grpc` both have package name `grpccorrelation`. https://gitlab.com/gitlab-org/labkit/-/merge_requests/72 - Remove deprecated package `gitlab.com/gitlab-org/labkit/correlation/raven` - Consider moving `metrics/handler*` into a sub package, i.e., `gitlab.com/gitlab-org/labkit/metrics/http`, to avoid name clashes with other "types" of metrics, such as SQL (followup from https://gitlab.com/gitlab-org/labkit/-/merge_requests/90#note_446238662). - Replace logrus: https://gitlab.com/gitlab-org/labkit/-/issues/24 - Remove global state from the library e.g. reliance on global metrics registry, etc. </details>
epic