Skip to content

Conversation

@yarinzirlin
Copy link

  • Updated imports from v1 (gopkg.in/DataDog/dd-trace-go.v1) to v2 (github.com/DataDog/dd-trace-go/v2)
  • Updated struct types to use pointers (*tracer.Span, *tracer.SpanContext) as required by v2
  • Replaced deprecated ChildOf() pattern with modern v2 approach:
    • Use Span.StartChild() for direct parent spans
    • Use tracer.WithStartSpanConfig() for span contexts
  • Updated tests to handle v2 API changes (pointer types for mocktracer.Span)
  • Removed unused helper functions (newSpanContextReader, spanContextReader)
  • All tests passing

This upgrade ensures compatibility with the latest Datadog APM features and removes dependency on deprecated v1 APIs.

What was changed

Updated dd-trace-go from the deprecated v1 to v2

Why?

  1. dd-trace-go v1 stopped working

Checklist

  1. How was this tested:
    I ran the upgraded interceptor against my Datadog instance and saw the expected traces

- Updated imports from v1 (gopkg.in/DataDog/dd-trace-go.v1) to v2
(github.com/DataDog/dd-trace-go/v2)
- Updated struct types to use pointers (*tracer.Span,
*tracer.SpanContext) as required by v2
- Replaced deprecated ChildOf() pattern with modern v2 approach:
  - Use Span.StartChild() for direct parent spans
  - Use tracer.WithStartSpanConfig() for span contexts
- Updated tests to handle v2 API changes (pointer types for
mocktracer.Span)
- Removed unused helper functions (newSpanContextReader,
spanContextReader)
- All tests passing

This upgrade ensures compatibility with the latest Datadog APM features
and removes dependency on deprecated v1 APIs.
@yarinzirlin yarinzirlin requested a review from a team as a code owner November 18, 2025 08:36
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@hferentschik
Copy link

+1 for switching to dd-trace-go v2

@Quinn-With-Two-Ns
Copy link
Contributor

Just a quick update, the data dog tracing module was contributed by an external team and we are currently reaching out to them to review this change.

"strings"

"gopkg.in/DataDog/dd-trace-go.v1/ddtrace"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
Copy link
Contributor

@jlegrone jlegrone Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two breaking changes here. They won't impact all users, but:

  • Anyone specifying a TracerOptions.OnFinish function will need to modify their imports from gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer to github.com/DataDog/dd-trace-go/v2/ddtrace/tracer. The old and new versions of this type are source compatible however, so no other changes are needed.
  • Anyone using the SpanFromWorkflowContext function will need to modify their code to reference the new type if they pass the returned span into a function accepting the old ddtrace.Span type, or if they were calling the Context() method.

Breaking changes are technically ok to do without releasing a v2 of this module, since we are still on a pre-stable version (v0.4.0). I think it is acceptable to release this as v0.5.0 as long as we document these breaking changes in the release notes. If necessary, we should still be able to backport bugfixes by tagging a v0.4.1 version.

@yarinzirlin would you like to take a stab at writing the release notes for this version?

Copy link
Contributor

@yuandrew yuandrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants