このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください
This documentation assumes that you are using version v1.x of the Go tracer. If you are already using v2.x, see Go Custom Instrumentation using the Datadog API instead.

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.

Migration tool features

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.

Using the migration tool

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

お役に立つドキュメント、リンクや記事: