Migrating from v1 to v2 of the Go Tracer
Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel,
n'hésitez pas à nous contacter.
This guide explains how to migrate from Go Tracer v1.x to v2. See Go tracer support.
Version 2 of the Go tracer introduces significant API improvements:
- Removes interfaces to enable future flexibility
- Isolates integrations to prevent false positives from security scanners
- Enforces library patterns to prevent misuse
To simplify the migration process, Datadog provides a migration tool that handles essential code updates automatically.
The migration tool automatically updates your tracing code when upgrading from dd-trace-go
v1.x to v2.0. It makes the following changes:
- Updates import URLs from
dd-trace-go.v1
to dd-trace-go/v2
. - Moves imports and using certain types from
ddtrace/tracer
to ddtrace
. - Converts
Span
and SpanContext
calls to use pointers. - Replaces unsupported
WithServiceName()
calls with WithService()
. - Updates
TraceID()
calls to TraceIDLower()
for obtaining uint64
trace IDs.
Run these commands to use the migration tool:
go get github.com/DataDog/dd-trace-go/v2/tools/v2check
go run github.com/DataDog/dd-trace-go/v2/tools/v2check/main.go
For more information about the migration, see the godoc page for dd-trace-go v2.
Further reading
Documentation, liens et articles supplémentaires utiles: