The otaws
package makes it easy to add OpenTracing support for AWS SDK in Go.
go get github.com/opentracing-contrib/go-aws-sdk
See the basic usage examples below and the package documentation on godoc.org.
// You must have some sort of OpenTracing Tracer instance on hand
var tracer opentracing.Tracer = ...
// Optionally set Tracer as global
opentracing.SetGlobalTracer(tracer)
// Create AWS Session
sess := session.NewSession(...)
// Create AWS service client e.g. DynamoDB client
dbCient := dynamodb.New(sess)
// Add OpenTracing handlers using global tracer
AddOTHandlers(dbClient.Client)
// Or specify tracer explicitly
AddOTHandlers(dbClient.Client, WithTracer(tracer))
// Call AWS client
result, err := dbClient.ListTables(&dynamodb.ListTablesInput{})