Setup
Om uw gebruik van MongoDB te instrumenteren, importeert u het officiële OpenTelemetry-instrumentatiepakket:otelmongo.NewMonitor() toe als monitor in de verbindingsopties, zoals in het onderstaande voorbeeld.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
import "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo"
otelmongo.NewMonitor() toe als monitor in de verbindingsopties, zoals in het onderstaande voorbeeld.
opts := options.Client()
opts.Monitor = otelmongo.NewMonitor()
opts.ApplyURI("mongodb://your.mongo.host:27017")
client, err := mongo.Connect(ctx, opts)
if err != nil {
panic(err)
}
Was deze pagina nuttig?