beeline-go: github.com/honeycombio/beeline-go/wrappers/hnygorilla Index | Examples | Files

package hnygorilla

import "github.com/honeycombio/beeline-go/wrappers/hnygorilla"

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/master/examples

Index

Examples

Package Files

doc.go gorilla.go

func Middleware Uses

func Middleware(handler http.Handler) http.Handler

Middleware is a gorilla middleware to add Honeycomb instrumentation to the gorilla muxer.

Code:

// 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)

Package hnygorilla imports 5 packages (graph) and is imported by 2 packages. Updated 2019-03-18. Refresh now. Tools for package owners.