Documentation ¶
Overview ¶
Package requestid contains functions to handle an id for the current request.
The idea is to read the current id from the received request and pass it to downstream services in order to get a trace across service boundaries.
Logstatements should log the request id in every statement to correlate the statements to a specific request. This simplifies the tracking of a request through a system which serves multiple concurrent requests.
Example:
func main() { mux := http.NewServeMux() mux.Handle("/hello", requestid.AddToCtx()(helloHandler())) } func helloHandler() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // get id from context rid,_ := requestid.FromCtx(r.Context()) }) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.