Commits on Source 8

  • Doug Barrett's avatar
    feat(v2/httpserver): Add HTTP server with built-in health probes · 584c63ae
    Doug Barrett authored
    Production-ready HTTP server implementing app.Component with automatic
    /-/liveness and /-/readiness endpoints. Readiness checks are chainable
    and run concurrently. Includes request logging and tracing middleware.
    584c63ae
  • Doug Barrett's avatar
    refactor(v2/httpserver): Abstract router interface for framework swappability · 1e1d490a
    Doug Barrett authored
    Replace gorilla/mux with stdlib net/http as the default router. Expose
    a Router interface so the underlying implementation can be swapped
    without breaking consumers. No framework types in the public API.
    
    Changes:
    - Define Router interface with Handle, HandleFunc, Use, ServeHTTP
    - Default implementation uses Go 1.22+ net/http.ServeMux with method
      pattern matching (GET /-/liveness, etc.)
    - Add Config.Router for custom Router injection
    - Middleware signatures use func(http.Handler) http.Handler (stdlib)
    - Health check endpoints still registered automatically
    - Tests exercise the Router interface, not a concrete framework
    - New tests for Handle, Use middleware, and custom Router injection
    1e1d490a
  • Doug Barrett's avatar
    fix(v2/httpserver): Run readiness checks concurrently and log JSON encoding errors · 8650e619
    Doug Barrett authored
    Execute readiness checks using goroutines so a slow check does not block
    others, matching the documented concurrent behavior. Also log JSON
    encoding failures in writeJSON for debugging.
    8650e619
  • Doug Barrett's avatar
    fix(v2/httpserver): Fix race condition in router init and use configured logger · 4befdbea
    Doug Barrett authored
    Use sync.Once for thread-safe lazy initialization of the handler chain
    in defaultRouter.ServeHTTP, preventing concurrent goroutines from
    building the chain simultaneously. Also use the server's configured
    logger in writeJSON instead of slog.Default() for consistency.
    4befdbea
  • Doug Barrett's avatar
    fix(v2/httpserver): Add Name(), context-aware listener, and error prefixes · a1da0c7a
    Doug Barrett authored
    Address AGENTS.md review findings:
    - Add Name field to Config with default "httpserver" for component
      identification in logs and errors
    - Use net.ListenConfig.Listen(ctx) in Start to honour context
      cancellation during bind
    - Wrap Shutdown errors with the component name
    - Fix doc.go claim about logging middleware recording duration
      (it only logs method, path, and status)
    a1da0c7a
  • Doug Barrett's avatar
    feat(v2/httpserver): Switch to chi as the default router · 9ac3ddad
    Doug Barrett authored
    Replace the stdlib net/http.ServeMux default with go-chi/chi, exposing
    Chi's key features through the Router interface while keeping Chi types
    out of the public API (design requirement from team-tasks#4283).
    
    Router interface changes:
    - Add method-specific registration: Get, Post, Put, Delete, Patch
    - Add route grouping: Group (scoped middleware), Route (path prefix)
    - Add sub-router mounting: Mount
    - Add per-route middleware: With
    - Add error handler customization: NotFound, MethodNotAllowed
    - Add URLParam helper for path parameter extraction
    
    Architecture changes:
    - Default Router backed by chi.Mux (wrapped in unexported chiRouter)
    - Built-in middleware (tracing, logging) registered via Use before user
      routes, running inside chi's routing context for access to route
      patterns
    - Health endpoints (/-/liveness, /-/readiness) handled by Server.ServeHTTP
      directly, outside the user's route tree
    - Tracing middleware uses chi.RouteContext for low-cardinality span names
      (e.g. "GET /users/{id}" instead of "GET /users/42")
    - Compile-time app.Component assertion added
    
    Removed:
    - routerbench standalone benchmark module (Chi/Gorilla/stdlib comparison
      served its purpose during the investigation phase)
    9ac3ddad
  • Doug Barrett's avatar
  • Elliot Forbes's avatar
    Merge branch 'v2-httpserver' into 'master' · 239473e1
    Elliot Forbes authored
    feat(v2/httpserver): Add HTTP server with built-in health probes
    
    See merge request !339
    
    
    
    Merged-by: Elliot Forbes's avatarElliot Forbes <eforbes@gitlab.com>
    Approved-by: Elliot Forbes's avatarElliot Forbes <eforbes@gitlab.com>
    Reviewed-by: default avatarGitLab Duo <gitlab-duo@gitlab.com>
    Co-authored-by: default avatardbarrett <dbarrett@gitlab.com>
    239473e1
Loading
Loading