The Monitor

Announcing Go tracer v2.0.0

6 min read

Share article

Announcing Go tracer v2.0.0
Dario Castañé

Dario Castañé

Datadog has long supported the monitoring of instrumented Go applications through our Go tracer v1. As the Go ecosystem has continued to mature, we’ve been hard at work collecting feedback and improving upon the tracer’s capabilities and usability features.

We are now thrilled to announce the release of our Go tracer v2.0.0. This major update includes better security and stability, and a new and simplified API. In creating this updated version, we have incorporated valuable feedback both from our customer community and from our own teams at Datadog who use the Go tracer extensively. We have already tested this new version in production and have migrated all our internal services.

This post will introduce the new features of Go tracer v2 and provide guidance for users about how to upgrade.

Improved developer experience and security

The new version of the Go tracer offers a number of new improvements.

Simpler API

The Go tracer v2 provides a simpler, leaner, and more consistent API that improves the developer experience. For example, child spans are now created using the StartChild method on the parent span. Moreover, all options are now standardized with the same signature across all contribs (integrations), making it easier to use them in a consistent way.

Enhanced security posture

The new Go tracer version overhauls the older approach to integrations. Previously, we used a single Go module to hold all our contribs. In v2, we've reduced the number of dependencies on dd-trace-go, isolating our contribs' dependencies in their own modules so that these integrations are now all independent modules. This change keeps the number of exposed dependencies to a minimum and prevents false positives—in security scanners and automation tools like Dependabot—that were previously caused by exposing indirect dependencies.

Import URL change

In v2, we have moved away from using gopkg.in as our public package repository in favor of github.com. This change reflects the need for a more scalable and reliable solution.

The new repository affects the import URL in different ways for different types of dependencies. For example, to import the tracer library itself, you now use:

import “github.com/DataDog/dd-trace-go/v2/ddtrace/tracer”

To import third-party contrib packages, you would use a URL with the following pattern:

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

For example, to import the net/http integration, you would use the following URL:

import “github.com/DataDog/dd-trace-go/contrib/net/http/v2”

For a list of the Go tracer’s supported packages and their import URLs, see our documentation.

Config structs

We’ve introduced support for providing all configurations in a single struct, which can now be passed to the NewStartSpanConfig and WithStartSpanConfig functions and replace the need for multiple distinct functional options. This gives you more control over the tracer's impact on hot paths in your code and allows you to reduce CPU overhead by preparing common span tags in your traces. Note that the Go functional options are still supported, but see this article by a Datadog engineer for some background about related performance issues.

To view the complete set of changes implemented in this release, refer to the issues and PRs marked with the v2.0 label in our GitHub repository.

Upgrade guidance

You can upgrade to the Go tracer v2 by following the instructions in our migration guide. As mentioned in the guide, we provide a v2 Migration Tool to simplify the upgrade process.

For more information, refer to our Go tracer documentation and the godoc page.

Go tracer v1.74.0: The v1 transitional version

For customers that have large codebases and that are unable to completely upgrade services to the Go tracer v2 by the end-of-life for v1, we are offering a special transitional version of the Go tracer v1. The Go tracer v1 transitional version is a wrapper that preserves the API from v1 but uses v2 under the hood.

The transitional version is the only v1 version that allows both v1 and v2 to be imported in the same service—enabling you to migrate a service gradually. Using this v1 transitional version doesn’t require any code changes, but it also won’t support any new features introduced in the new v2 tracer.

The v1 transitional version is available as v1.74.0. We encourage all customers to upgrade to this transitional version while they prepare to transition their existing services to v2. We also encourage all customers to use v2 only for new services. If you have concerns or reasons to not upgrade to the transitional version, contact us and we’ll work together to resolve them.

Consult our documentation for more key dates related to our Go tracer version support.

Although we are offering the v1 transitional version for the convenience of our customers, we strongly encourage you to upgrade to the v2 version as soon as possible to benefit from the newest features and improvements.

Try out the Datadog Go tracer v2

Our work does not end here. We will continue to incorporate both internal and external feedback from the Datadog community in future updates to our new Go tracing v2 client. Try it out and let us know what you think! We are eager to receive your feedback.

We hope that you will be as happy as we are with these changes, and we look forward to continuing to deliver a stable, full-featured, and bug-free tracing system for you to use in your Go applications. If you need support or have any questions, feel free to ask us or submit a question on GitHub.

And if you’re not yet a Datadog customer, you can sign up for our .

Related Articles

Orchestrion: Compile-time auto-instrumentation for Go

Orchestrion: Compile-time auto-instrumentation for Go

Go memory metrics demystified

Go memory metrics demystified

Real-time distributed tracing for Go and Java Lambda Functions

Real-time distributed tracing for Go and Java Lambda Functions

Announcing Go tracer v1.0.0

Announcing Go tracer v1.0.0

Start monitoring your metrics in minutes