Gorilla Mux Instrumentation
Gorilla Mux is a popular request router and dispatcher for the Go language.
Setup
To instrument your Gorilla Mux application, you'll need to import the OpenTelemetry official instrumentation package:
Shell
import "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
The Gorilla Mux instrumentation is packaged as a router middleware, as you can see in the example below, the tracer initialization is called before anything as described in more detail in the Go Configuration section. Adding otelmux.Middleware()
to your app router is all that you need to get all your requests instrumented.
Reporting request parameters
By default, the Gorilla instrumentation does not report any incoming request parameters, like query strings and JSON body contents.
To report these values to AppSignal, add a middleware to your Gorilla stack as follows: