route

package
v1.1.52-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const HeaderRequestID = "X-Request-Id"

HeaderRequestID carries the caller's trace id; it is echoed back as the request's trace id.

Variables

This section is empty.

Functions

func InjectCommonContextVars

func InjectCommonContextVars(ctx context.Context) context.Context

InjectCommonContextVars ensures ctx carries a non-empty trace id and a remote IP value (empty when unknown), so downstream logging can rely on both keys being present.

func InjectCommonRequestContextVars

func InjectCommonRequestContextVars(r *http.Request) *http.Request

InjectCommonRequestContextVars returns the request with a context carrying the trace id from the X-Request-Id header (a fresh UUID when absent) and the caller's remote IP.

func Route

func Route(rtr *mux.Router, path string, routerHandler http.HandlerFunc) *mux.Route

Route registers routerHandler at path, wrapping it so that every request gets a trace id and remote IP in its context and its duration observed in http_request_duration_seconds{method,path}.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL