Gin-gonic Instrumentation
Gin-gonic is a full featured web framework for Go.
Setup
To instrument your Go-gin application, you'll need to import the OpenTelemetry official instrumentation package:
Shell
import "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
The Go-gin 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 page. Adding otelgin.Middleware()
to your app router is all that you need to get all your requests instrumented.
Reporting request parameters
By default, the Gin 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: