Documentation ¶
Overview ¶
Package hnygorilla has Middleware to use with the Gorilla muxer.
Summary ¶
hnygorilla has Middleware to wrap individual handlers, and is best used in conjunction with the nethttp WrapHandler function. Using these two together will get you an event for every request that comes through your application while also decorating the most interesting paths (the handlers that you wrap) with additional fields from the Gorilla patterns.
For a complete example showing this wrapper in use, please see the examples in https://github.com/honeycombio/beeline-go/tree/main/examples
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
Middleware is a gorilla middleware to add Honeycomb instrumentation to the gorilla muxer.
Example ¶
// assume you have handlers named root and hello var root func(w http.ResponseWriter, r *http.Request) var hello func(w http.ResponseWriter, r *http.Request) r := mux.NewRouter() r.Use(Middleware) // Routes consist of a path and a handler function. r.HandleFunc("/", root) r.HandleFunc("/hello/{person}", hello)
Output:
Types ¶
This section is empty.