Skip to content

feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT#6757

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 12 commits into
mainfrom
augusto/dd-trace-go-trace-context-propagation-extraction-modes
Jun 19, 2026
Merged

feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT#6757
gh-worker-dd-mergequeue-cf854d[bot] merged 12 commits into
mainfrom
augusto/dd-trace-go-trace-context-propagation-extraction-modes

Conversation

@igoragoli

Copy link
Copy Markdown
Contributor

Motivation

dd-trace-go now implements all three extraction behavior modes for DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT per RFC feature 353:

  • continue (default): continues the extracted trace context
  • restart: starts a new trace, creating a span link to the extracted context
  • ignore: ignores any extracted trace context entirely

Also supports the restart+extract_first combination.

Implementation is in the dd-trace-go branch: augusto/trace-context-propagation-extraction-modes

Changes

Remove the four missing_feature markers for Test_ExtractBehavior_* tests in manifests/golang.yml and replace them with version markers targeting v2.9.0-dev.

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@github-actions

github-actions Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

manifests/golang.yml                                                    @DataDog/dd-trace-go-guild
utils/build/docker/golang/app/chi/main.go                               @DataDog/dd-trace-go-guild @DataDog/system-tests-core
utils/build/docker/golang/app/echo/main.go                              @DataDog/dd-trace-go-guild @DataDog/system-tests-core
utils/build/docker/golang/app/gin/main.go                               @DataDog/dd-trace-go-guild @DataDog/system-tests-core
utils/build/docker/golang/app/net-http-orchestrion/main.go              @DataDog/dd-trace-go-guild @DataDog/system-tests-core
utils/build/docker/golang/app/net-http/main.go                          @DataDog/dd-trace-go-guild @DataDog/system-tests-core

@igoragoli igoragoli changed the title feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT [golang@augusto/trace-context-propagation-extraction-modes] Apr 16, 2026
@igoragoli igoragoli changed the title feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT [golang@augusto/trace-context-propagation-extraction-modes] feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT Apr 16, 2026
@igoragoli igoragoli changed the title feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT [golang@augusto/trace-context-propagation-extraction-modes] Apr 28, 2026
@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Apr 28, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 21cfecb | Docs | Datadog PR Page | Give us feedback!

gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/dd-trace-go that referenced this pull request May 28, 2026
### What does this PR do?

Implements `DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT` for dd-trace-go.

See [RFC](https://docs.google.com/document/d/1KWx5F-XEzJ55XZPwY30t0otVIyOUYHWsDhEt3YPDnso/edit?pli=1&tab=t.0).

Three modes:
- **`continue`** (default): existing behavior -- incoming trace context is used as the local trace context. Baggage is propagated.
- **`restart`**: starts a new trace with a fresh trace ID and sampling decision. The incoming context is referenced via a span link with `reason=propagation_behavior_extract`. Baggage is propagated.
- **`ignore`**: discards the entire incoming trace context. Returns `nil, nil` from `Extract()` so callers produce a fresh root span with no parent, no span links, and no baggage.

When `DD_TRACE_PROPAGATION_EXTRACT_FIRST=true` is combined with `restart`, baggage is explicitly extracted after the first propagator returns, since the RFC requires baggage to be propagated in `restart` mode regardless.

### Motivation

See RFC: [Trace Context Propagation Extraction Modes](https://docs.google.com/document/d/1htJFBWR4RFpmK1i6wopxkZwlvYu9unkPJnMnTom4Xjo)
System-tests PR: DataDog/system-tests#6757

### Reviewer's Checklist

- [x] Changed code has unit tests for its functionality at or near 100% coverage.
- [x] [System-Tests](https://github.com/DataDog/system-tests/) covering this feature have been added and enabled with the va.b.c-dev version tag.

Note: Still working on it: DataDog/system-tests#6757

- [ ] There is a benchmark for any new code, or changes to existing code.

Note: Benchmarking is explicitly out of scope per the RFC ("the processing overhead is minimal in comparison to the rest of the context extraction operation").

- [x] If this interacts with the agent in a new way, a system test has been added.
- [x] New code is free of linting errors. You can check this by running `make lint` locally.
- [x] New code doesn't break existing tests. You can check this by running `make test` locally.
- [x] Add an appropriate team label so this PR gets put in the right place for the release notes.
- [x] All generated files are up to date. You can check this by running `make generate` locally.
- [x] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running `make fix-modules` locally.

Unsure? Have a question? Request a review!


Co-authored-by: genesor <[email protected]>
Co-authored-by: kakkoyun <[email protected]>
@genesor
genesor marked this pull request as ready for review June 11, 2026 19:52
@genesor
genesor requested review from a team as code owners June 11, 2026 19:52
@datadog-system-tests-org

datadog-system-tests-org Bot commented Jun 19, 2026

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

🚦 16 Pipeline jobs failed

Testing the test | System Tests (golang, prod) / End-to-end #16 / chi 16   View in Datadog   GitHub Actions

Testing the test | System Tests (golang, prod) / End-to-end #17 / chi 17   View in Datadog   GitHub Actions

Testing the test | System Tests (golang, prod) / End-to-end #17 / net-http 17   View in Datadog   GitHub Actions

View all 16 failed jobs.

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ec318e3 | Docs | Give us feedback!

@genesor genesor changed the title feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT [golang@augusto/trace-context-propagation-extraction-modes] feat(golang): implement DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT Jun 19, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 153bc29 into main Jun 19, 2026
300 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the augusto/dd-trace-go-trace-context-propagation-extraction-modes branch June 19, 2026 22:14
darccio added a commit that referenced this pull request Jun 26, 2026
…l make_distant_call

PR #6757 added span-context injection and header-key lowercasing to the
net-http /make_distant_call handler and activated
Test_ExtractBehavior_Restart_With_Extract_First at v2.10.0-dev for all Go
weblogs. The net-http-span-pool clone never received the matching handler
change, so after merging main the test ran against span-pool and failed with
KeyError: 'x-datadog-trace-id'.

Mirror the net-http handler: inject the active span context into the outbound
request headers and lowercase the captured request-header keys.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants