Documentation
¶
Overview ¶
Package http provides debug HTTP routing helpers for go-service.
This package provides a small wrapper around go-service's `net/http` primitives to build a dedicated debug endpoint router. The root debug package registers its built-in endpoint handlers on the mux returned by `NewServeMux`.
Routing conventions ¶
Handlers are typically registered using `Pattern`, which prefixes the provided route pattern with the service name to form a stable debug route namespace.
Start with `ServeMux`, `NewServeMux`, and `Pattern`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Pattern ¶ added in v2.61.0
Pattern builds a debug route pattern for name and pattern.
This is a thin wrapper around `net/http.Pattern`, which prefixes the provided pattern with the service name to form routes like:
/<name><pattern>
Example:
Pattern(name, "/debug/pprof/") // -> "/my-service/debug/pprof/"
Types ¶
type ServeMux ¶
ServeMux wraps `net/http.ServeMux` for debug routing.
It exists primarily to provide a stable type that can be injected via DI as "the debug mux".
func NewServeMux ¶
func NewServeMux() *ServeMux
NewServeMux constructs a new debug ServeMux.
The returned mux is a small wrapper over go-service's `net/http.ServeMux` and is intended as the shared router where debug endpoint packages register their handlers (pprof, fgprof, statsviz, psutil, etc.).