Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM Go] fix and clarify dd-trace-go v2 docs for release #28292

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve migration guide.
brett0000FF committed Mar 26, 2025
commit baa2852aa098ff017e0ed42c3c37b5a1aa2137a2
4 changes: 3 additions & 1 deletion content/en/tracing/guide/tutorial-enable-go-host.md
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ This tutorial walks you through the steps for enabling tracing on a sample Go ap

For other scenarios, including applications in containers or on cloud infrastructure, Agent in a container, and applications written in different languages, see the other [Enabling Tracing tutorials][1].

See [Tracing Go Applications][2] for general comprehensive tracing setup documentation for Go. If you are using [version 2.x of the Go Tracer][18], use the instructions marked with `2.x`.
See [Tracing Go Applications][2] for general comprehensive tracing setup documentation for Go.

### Prerequisites

@@ -93,6 +93,8 @@ make exitNotes

## Install Datadog tracing

{{% tracing-go-v2 %}}

Next, install the Go tracer. From your `apm-tutorial-golang` directory, run:

{{< code-block lang="shell" >}}
256 changes: 130 additions & 126 deletions content/en/tracing/trace_collection/compatibility/go.md
Original file line number Diff line number Diff line change
@@ -48,9 +48,138 @@ Datadog recommends v2 of the Go tracer for all users. If you are using v1, see t

#### Framework compatibility

Integrate the Go tracer with the following list of web frameworks using one of the following helper packages. Supported frameworks have changed between v1 and v2 of the Go Tracer. To upgrade from v1 to v2 of the tracer and to learn more about the Go Tracer v2 Preview, visit our [migration guide][79].
Integrate the Go tracer with the following list of web frameworks using one of the following helper packages.

{{% tracing-go-v2 %}}

Supported frameworks have changed between v1 and v2 of the Go Tracer

{{< tabs >}}
{{% tab "v2" %}}

**Note**: The [integrations documentation][79] provides a detailed overview of the supported packages and their APIs, along with usage examples.

| Framework | Support Type | GoDoc Datadog Documentation |
|-------------------|-----------------|--------------------------------------------------------------------------|
| [Gin][6] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gin-gonic/gin/v2][80] |
| [Gorilla Mux][8] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gorilla/mux/v2][81] |
| [gRPC][10] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2][82] |
| [chi][13] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/go-chi/chi/v2][83] |
| [echo v4][15] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/labstack/echo.v4/v2][84] |
| [Fiber][18] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gofiber/fiber.v2/v2][85] |

#### Library compatibility

The Go tracer includes support for the following data stores and libraries.

| Library | Support Type | Examples and Documentation |
|-------------------------|-----------------|---------------------------------------------------------------------------------|
| [AWS SDK][20] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go/aws/v2][86] |
| [AWS SDK v2][75] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go-v2/aws/v2][113] |
| [Elasticsearch][22] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/olivere/elastic.v5/v2][87] |
| [Cassandra][24] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gocql/gocql/v2][88] |
| [GraphQL][26] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/graph-gophers/graphql-go/v2][89] |
| [HTTP][28] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/net/http/v2][90] |
| [HTTP router][30] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/julienschmidt/httprouter/v2][91] |
| [Redis (go-redis)][32] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/go-redis/redis/v2][92] |
| [Redis (go-redis-v8)][34]| Fully Supported | [github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v8/v2][93] |
| [Redis (redigo)][36] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/garyburd/redigo/v2][94] |
| [Redis (new redigo)][38]| Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gomodule/redigo/v2][95] |
| [SQL][40] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/database/sql/v2][96] |
| [SQLx][42] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/jmoiron/sqlx/v2][97] |
| [MongoDB][44] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/go.mongodb.org/mongo-driver/mongo/v2][98] |
| [MongoDB (mgo)][73] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/globalsign/mgo/v2][99] |
| [BuntDB][47] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/tidwall/buntdb/v2][100] |
| [LevelDB][49] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/syndtr/goleveldb/leveldb/v2][101] |
| [miekg/dns][51] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/miekg/dns/v2][102] |
| [Kafka (confluent)][53] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/confluentinc/confluent-kafka-go/v2][103] |
| [Kafka (sarama)][55] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/IBM/sarama/v2][104] |
| [Google API][57] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/google.golang.org/api/v2][105] |
| [go-restful][59] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/emicklei/go-restful.v3/v2][106] |
| [Twirp][61] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/twitchtv/twirp/v2][107] |
| [Vault][63] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/hashicorp/vault/v2][108] |
| [Consul][65] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/hashicorp/consul/v2][109] |
| [Gorm v2][69] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gorm.io/gorm.v1/v2][110] |
| [Kubernetes][71] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/k8s.io/client-go/kubernetes/v2][111] |
| [Memcache][73] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/bradfitz/gomemcache/memcache/v2][112] |


Packages must be imported with:

```go
import "github.com/DataDog/dd-trace-go/contrib/<PACKAGE_DIR>/<PACKAGE_NAME>/v2"
```

[79]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/contrib
[6]: https://gin-gonic.com
[80]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gin-gonic/gin/v2
[8]: http://www.gorillatoolkit.org/pkg/mux
[81]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gorilla/mux/v2
[10]: https://github.com/grpc/grpc-go
[82]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2
[13]: https://github.com/go-chi/chi
[83]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/go-chi/chi/v2
[15]: https://github.com/labstack/echo
[84]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/labstack/echo.v4/v2
[18]: https://github.com/gofiber/fiber
[85]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gofiber/fiber.v2/v2
[20]: https://aws.amazon.com/sdk-for-go
[86]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go/aws/v2
[75]: https://aws.github.io/aws-sdk-go-v2/docs/
[113]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go-v2/aws/v2
[22]: https://github.com/olivere/elastic
[87]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/olivere/elastic.v5/v2
[24]: https://github.com/gocql/gocql
[88]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gocql/gocql/v2
[26]: https://github.com/graph-gophers/graphql-go
[89]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/graph-gophers/graphql-go/v2
[28]: https://golang.org/pkg/net/http
[90]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/net/http/v2
[30]: https://github.com/julienschmidt/httprouter
[91]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/julienschmidt/httprouter/v2
[32]: https://github.com/go-redis/redis
[92]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/go-redis/redis/v2
[34]: https://github.com/go-redis/redis/v8
[93]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v8/v2
[36]: https://github.com/garyburd/redigo
[94]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/garyburd/redigo/v2
[38]: https://github.com/gomodule/redigo
[95]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gomodule/redigo/v2
[40]: https://golang.org/pkg/database/sql
[96]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/database/sql/v2
[42]: https://github.com/jmoiron/sqlx
[97]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/jmoiron/sqlx/v2
[44]: https://github.com/mongodb/mongo-go-driver
[98]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/go.mongodb.org/mongo-driver/mongo/v2
[73]: https://github.com/bradfitz/gomemcache/memcache
[99]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/globalsign/mgo/v2
[47]: https://github.com/tidwall/buntdb
[100]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/tidwall/buntdb/v2
[49]: https://github.com/syndtr/goleveldb
[101]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/syndtr/goleveldb/leveldb/v2
[51]: https://github.com/miekg/dns
[102]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/miekg/dns/v2
[53]: https://github.com/confluentinc/confluent-kafka-go
[103]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/confluentinc/confluent-kafka-go/v2
[55]: https://github.com/Shopify/sarama
[104]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/IBM/sarama/v2
[57]: https://github.com/googleapis/google-api-go-client
[105]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/google.golang.org/api/v2
[59]: https://github.com/emicklei/go-restful
[106]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/emicklei/go-restful.v3/v2
[61]: https://github.com/twitchtv/twirp
[107]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/twitchtv/twirp/v2
[63]: https://github.com/hashicorp/vault
[108]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/hashicorp/vault/v2
[65]: https://github.com/hashicorp/consul
[109]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/hashicorp/consul/v2
[69]: https://gorm.io/
[110]: https://github.com/DataDog/dd-trace-go/contrib/gorm.io/gorm.v1/v2
[71]: https://github.com/kubernetes/client-go
[111]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/k8s.io/client-go/kubernetes/v2
[73]: https://github.com/bradfitz/gomemcache/memcache
[112]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/bradfitz/gomemcache/memcache/v2
{{% /tab %}}
{{% tab "v1" %}}
**Note**: The [integrations documentation][5] provides a detailed overview of the supported packages and their APIs, along with usage examples.

@@ -183,131 +312,6 @@ import "gopkg.in/DataDog/dd-trace-go.v1/contrib/<PACKAGE_DIR>/<PACKAGE_NAME>"
[75]: https://aws.github.io/aws-sdk-go-v2/docs/
[76]: https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go-v2/aws
{{% /tab %}}
{{% tab "v2" %}}

**Note**: The [integrations documentation][79] provides a detailed overview of the supported packages and their APIs, along with usage examples.

| Framework | Support Type | GoDoc Datadog Documentation |
|-------------------|-----------------|--------------------------------------------------------------------------|
| [Gin][6] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gin-gonic/gin/v2][80] |
| [Gorilla Mux][8] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gorilla/mux/v2][81] |
| [gRPC][10] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2][82] |
| [chi][13] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/go-chi/chi/v2][83] |
| [echo v4][15] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/labstack/echo.v4/v2][84] |
| [Fiber][18] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gofiber/fiber.v2/v2][85] |

#### Library compatibility

The Go tracer includes support for the following data stores and libraries.

| Library | Support Type | Examples and Documentation |
|-------------------------|-----------------|---------------------------------------------------------------------------------|
| [AWS SDK][20] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go/aws/v2][86] |
| [AWS SDK v2][75] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go-v2/aws/v2][113] |
| [Elasticsearch][22] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/olivere/elastic.v5/v2][87] |
| [Cassandra][24] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gocql/gocql/v2][88] |
| [GraphQL][26] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/graph-gophers/graphql-go/v2][89] |
| [HTTP][28] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/net/http/v2][90] |
| [HTTP router][30] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/julienschmidt/httprouter/v2][91] |
| [Redis (go-redis)][32] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/go-redis/redis/v2][92] |
| [Redis (go-redis-v8)][34]| Fully Supported | [github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v8/v2][93] |
| [Redis (redigo)][36] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/garyburd/redigo/v2][94] |
| [Redis (new redigo)][38]| Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gomodule/redigo/v2][95] |
| [SQL][40] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/database/sql/v2][96] |
| [SQLx][42] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/jmoiron/sqlx/v2][97] |
| [MongoDB][44] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/go.mongodb.org/mongo-driver/mongo/v2][98] |
| [MongoDB (mgo)][73] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/globalsign/mgo/v2][99] |
| [BuntDB][47] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/tidwall/buntdb/v2][100] |
| [LevelDB][49] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/syndtr/goleveldb/leveldb/v2][101] |
| [miekg/dns][51] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/miekg/dns/v2][102] |
| [Kafka (confluent)][53] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/confluentinc/confluent-kafka-go/v2][103] |
| [Kafka (sarama)][55] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/IBM/sarama/v2][104] |
| [Google API][57] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/google.golang.org/api/v2][105] |
| [go-restful][59] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/emicklei/go-restful.v3/v2][106] |
| [Twirp][61] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/twitchtv/twirp/v2][107] |
| [Vault][63] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/hashicorp/vault/v2][108] |
| [Consul][65] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/hashicorp/consul/v2][109] |
| [Gorm v2][69] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/gorm.io/gorm.v1/v2][110] |
| [Kubernetes][71] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/k8s.io/client-go/kubernetes/v2][111] |
| [Memcache][73] | Fully Supported | [github.com/DataDog/dd-trace-go/contrib/bradfitz/gomemcache/memcache/v2][112] |


Packages must be imported with:

```go
import "github.com/DataDog/dd-trace-go/contrib/<PACKAGE_DIR>/<PACKAGE_NAME>/v2"
```

[79]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/contrib
[6]: https://gin-gonic.com
[80]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gin-gonic/gin/v2
[8]: http://www.gorillatoolkit.org/pkg/mux
[81]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gorilla/mux/v2
[10]: https://github.com/grpc/grpc-go
[82]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2
[13]: https://github.com/go-chi/chi
[83]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/go-chi/chi/v2
[15]: https://github.com/labstack/echo
[84]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/labstack/echo.v4/v2
[18]: https://github.com/gofiber/fiber
[85]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gofiber/fiber.v2/v2
[20]: https://aws.amazon.com/sdk-for-go
[86]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go/aws/v2
[75]: https://aws.github.io/aws-sdk-go-v2/docs/
[113]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go-v2/aws/v2
[22]: https://github.com/olivere/elastic
[87]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/olivere/elastic.v5/v2
[24]: https://github.com/gocql/gocql
[88]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gocql/gocql/v2
[26]: https://github.com/graph-gophers/graphql-go
[89]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/graph-gophers/graphql-go/v2
[28]: https://golang.org/pkg/net/http
[90]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/net/http/v2
[30]: https://github.com/julienschmidt/httprouter
[91]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/julienschmidt/httprouter/v2
[32]: https://github.com/go-redis/redis
[92]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/go-redis/redis/v2
[34]: https://github.com/go-redis/redis/v8
[93]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v8/v2
[36]: https://github.com/garyburd/redigo
[94]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/garyburd/redigo/v2
[38]: https://github.com/gomodule/redigo
[95]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/gomodule/redigo/v2
[40]: https://golang.org/pkg/database/sql
[96]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/database/sql/v2
[42]: https://github.com/jmoiron/sqlx
[97]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/jmoiron/sqlx/v2
[44]: https://github.com/mongodb/mongo-go-driver
[98]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/go.mongodb.org/mongo-driver/mongo/v2
[73]: https://github.com/bradfitz/gomemcache/memcache
[99]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/globalsign/mgo/v2
[47]: https://github.com/tidwall/buntdb
[100]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/tidwall/buntdb/v2
[49]: https://github.com/syndtr/goleveldb
[101]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/syndtr/goleveldb/leveldb/v2
[51]: https://github.com/miekg/dns
[102]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/miekg/dns/v2
[53]: https://github.com/confluentinc/confluent-kafka-go
[103]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/confluentinc/confluent-kafka-go/v2
[55]: https://github.com/Shopify/sarama
[104]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/IBM/sarama/v2
[57]: https://github.com/googleapis/google-api-go-client
[105]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/google.golang.org/api/v2
[59]: https://github.com/emicklei/go-restful
[106]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/emicklei/go-restful.v3/v2
[61]: https://github.com/twitchtv/twirp
[107]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/twitchtv/twirp/v2
[63]: https://github.com/hashicorp/vault
[108]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/hashicorp/vault/v2
[65]: https://github.com/hashicorp/consul
[109]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/hashicorp/consul/v2
[69]: https://gorm.io/
[110]: https://github.com/DataDog/dd-trace-go/contrib/gorm.io/gorm.v1/v2
[71]: https://github.com/kubernetes/client-go
[111]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/k8s.io/client-go/kubernetes/v2
[73]: https://github.com/bradfitz/gomemcache/memcache
[112]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/contrib/bradfitz/gomemcache/memcache/v2
{{% /tab %}}
{{< /tabs >}}

## Further Reading
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Migrating from v1 to v2 of the Go Tracer
title: Migrate to Go Tracer v2
description: 'Upgrade your Go tracer from v1 to v2.'
aliases:
- /tracing/trace_collection/custom_instrumentation/opentracing/go
@@ -9,43 +9,143 @@ further_reading:
text: 'Get started with v1 of the Go Tracer'
---

<div class="alert alert-info">This documentation assumes that you are using version v1.x of the Go tracer. If you are already using v2.x, see <a href="/tracing/trace_collection/custom_instrumentation/go/dd-api">Go Custom Instrumentation using the Datadog API</a> instead.</div>
## Overview

This guide explains how to migrate from Go Tracer v1.x to v2. See [Go tracer support][2].
The Go tracer v2 is a significant update to Datadog's Go tracing library that introduces API improvements, better performance, and enhanced compatibility with modern Go practices. It represents the latest stable version of Datadog's Go tracing library.

Version 2 of the Go tracer introduces significant API improvements:
## Compatibility

- Removes interfaces to enable future flexibility
- Isolates integrations to prevent false positives from security scanners
- Enforces library patterns to prevent misuse
When deciding which version of the Go tracer to use, consider the following guidance:

To simplify the migration process, Datadog provides a migration tool that handles essential code updates automatically.
- **For new projects**: Datadog recommends using v2 for all new projects.
- **For Existing Projects**: Datadog recommends migrating existing applications from v1 to take advantage of improvements and continued support.

## Migration tool features
## Support policy

The migration tool automatically updates your tracing code when upgrading from `dd-trace-go` v1.x to v2.0. It makes the following changes:
While v1 remains available, v2 is Datadog's primary supported version:

* 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.
- Bug fixes for v1 will be provided until June 30, 2025
- Security fixes for v1 will be provided until December 31, 2025
- After December 31, 2025, v1 will no longer receive updates

## Using the migration tool
For more compatibility and support details, see [Go Library Compatibility][2].

Run these commands to use the migration tool:
## Product-specific changes

Different Datadog products have specific considerations when migrating from v1 to v2. Here is what you need to know for each.

### Application Security Management (ASM)

Supported packages have changed between v1 and v2 of the Go tracer.

For more information, see [ASM language and framework compatibility][3].

### Software Composition Analysis (SCA)

Supported packages have changed between v1 and v2 of the Go tracer.

For more information, see [SCA language and framework compatibility][2].

### Tracing

The v2 tracing API offers significant improvements while maintaining a similar developer experience. The migration typically involves updating import paths and adapting to some API changes.

Supported frameworks have changed between v1 and v2 of the Go tracer.

For more information, see [Go Library Compatibility][4].

### Profiling

For the Profiler, only import paths need to be updated. The profiling API functionality remains the same between v1 and v2.

## Version 2 improvements

The Go tracer v2 introduces several important improvements:

- **Modern import path**: Moves from `gopkg.in` to the standard GitHub import path for better compatibility with Go modules.
- **Improved API design**: Provides a more intuitive interface with better performance and future extensibility.
- **Reduced dependency footprint**: Isolates integrations so you only pull in what you need.
- **Enhanced security**: Prevents false positives in security scanning tools.
- **Better OpenTelemetry compatibility**: Includes W3C trace context propagation and 128-bit trace ID support.

## Migration instructions

Datadog provides a migration tool that automatically handles most code updates when upgrading from v1 to v2.

To upgrade, run the following command:

```shell
go install github.com/DataDog/dd-trace-go/tools/v2check@latest
# In your repository's directory
v2check .
```

For more information about the migration, see the [godoc page for dd-trace-go v2][1].
The tool makes the following changes:

1. Updates import URLs from `gopkg.in/DataDog/dd-trace-go.v1` to `github.com/DataDog/dd-trace-go/v2`.
1. Moves imports from `ddtrace/tracer` to `ddtrace` where appropriate.
1. Converts `Span` and `SpanContext` calls to use pointers.
1. Replaces unsupported `WithServiceName()` calls with `WithService()`.
1. Updates `TraceID()` calls to `TraceIDLower()` for obtaining `uint64` trace IDs.

## Troubleshooting

### Import path changes

Change all imports from:
```go
import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace"
import "gopkg.in/DataDog/dd-trace-go.v1/profiler"
```

To:
```go
import "github.com/DataDog/dd-trace-go/v2/ddtrace"
import "github.com/DataDog/dd-trace-go/v2/profiler"
```

### Package structure changes

The package organization has changed in v2. Many functions previously in `ddtrace/tracer` have been moved to the `ddtrace` package. While the `v2check` migration tool handles these changes automatically, you may need to manually update some import paths.

v1:
```go
import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

func main() {
tracer.Start()
span := tracer.StartSpan("operation")
}
```

v2:
```go
import "github.com/DataDog/dd-trace-go/v2/ddtrace"

func main() {
ddtrace.Start()
span := ddtrace.StartSpan("operation")
}
```

### Configuration changes

The `WithServiceName()` option has been replaced with `WithService()` for consistency:
```go
// v1
tracer.Start(tracer.WithServiceName("my-service"))

// v2
ddtrace.Start(ddtrace.WithService("my-service"))
```

For more information, see the [godoc page for dd-trace-go v2][1].

## Further reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: https://godoc.org/github.com/DataDog/dd-trace-go/v2/
[2]: /tracing/trace_collection/compatibility/go/?tab=v1#go-tracer-support
[1]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/
[2]: /security/code_security/software_composition_analysis/setup_runtime/compatibility/go
[3]: /security/application_security/threats/setup/compatibility/go
[4]: /tracing/trace_collection/compatibility/go/#go-tracer-support