Skip to content

fix(tracer): Baggage extraction#3597

Merged
darccio merged 19 commits into
mainfrom
mtoff/iterate/rachel-baggage-bug
Jun 19, 2025
Merged

fix(tracer): Baggage extraction#3597
darccio merged 19 commits into
mainfrom
mtoff/iterate/rachel-baggage-bug

Conversation

@mtoffl01

@mtoffl01 mtoffl01 commented Jun 5, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Modifies the chainedPropagator.Extract method to store baggage in memory until another trace context is extracted. If no other trace context is extracted, then a dummy SpanContext with the baggage is returned. The returned SpanContext has new field onlyBaggage set to true. The returned span context is used as the parent SpanContext. When the child span is generated, it uses the SpanContext's trace context (that is: trace ID, span ID, sampling priority, and more) only if onlyBaggage is false. If onlyBaggage is false, a new trace is begun.

Motivation

The baggage propagator introduced in v1.73.0 broke trace extraction and trace injection in the case that the baggage propagator was the first propagator to run.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running golangci-lint run locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

rachelyangdog and others added 5 commits May 29, 2025 16:43
…anCtx with just baggage info in the case that baggage is the only tracing header avail in the request headers. Also, only use parent span and trace ID inside of spanStart method if these are non-empty / nonzero
@pr-commenter

pr-commenter Bot commented Jun 5, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-06-19 07:01:22

Comparing candidate commit cd1f592 in PR branch mtoff/iterate/rachel-baggage-bug with baseline commit a4574c2 in branch main.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 2 metrics, 0 unstable metrics.

scenario:BenchmarkSetTagStringer-24

  • 🟥 execution_time [+3.388ns; +5.532ns] or [+2.439%; +3.982%]

@mtoffl01 mtoffl01 mentioned this pull request Jun 9, 2025
7 tasks
@mtoffl01 mtoffl01 changed the title WIP: fix baggage extraction fix(tracer): Baggage extraction Jun 9, 2025
@mtoffl01
mtoffl01 marked this pull request as ready for review June 13, 2025 15:37
@mtoffl01
mtoffl01 requested review from a team as code owners June 13, 2025 15:37
Comment thread ddtrace/tracer/textmap.go Outdated
Co-authored-by: Dario Castañé <[email protected]>

@kakkoyun kakkoyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We agreed on this as a short-term mitigation. We will come up with longer-term solution.

@mtoffl01
mtoffl01 enabled auto-merge (squash) June 18, 2025 13:44
@mtoffl01
mtoffl01 disabled auto-merge June 18, 2025 15:24
@darccio
darccio merged commit 0d30571 into main Jun 19, 2025
220 checks passed
@darccio
darccio deleted the mtoff/iterate/rachel-baggage-bug branch June 19, 2025 07:17
genesor pushed a commit that referenced this pull request Jun 19, 2025
Co-authored-by: Rachel Yang <[email protected]>
Co-authored-by: Dario Castañé <[email protected]>
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.

4 participants