MongoDB instrumentation
Setup
To instrument your MongoDB usage, you'll need to import the OpenTelemetry official instrumentation package:
Shell
import "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo"
Before initializing your MongoDB connection, add the otelmongo.NewMonitor()
as a monitor in the connection options as shown in the example below.