hnygorilla

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 13

README

Documentation available via godoc

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

func Middleware(handler http.Handler) http.Handler

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.

Jump to

Keyboard shortcuts

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