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

WIP: Baggage Propagation #3126

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

WIP: Baggage Propagation #3126

wants to merge 18 commits into from

Conversation

rachelyangdog
Copy link
Contributor

@rachelyangdog rachelyangdog commented Jan 28, 2025

What does this PR do?

  • adds "baggage" as part of the default propagators
  • creates a baggage propagator and adds inject and extract functionality
  • properly encodes/decodes headers and drops excess baggage items and bytes
  • adds logic to get baggage from the request context and adds it to the span in order to inject into the headers

Motivation

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.
  • 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.
  • For internal contributors, a matching PR should be created to the v2-dev branch and reviewed by @DataDog/apm-go.

Unsure? Have a question? Request a review!

@rachelyangdog rachelyangdog requested review from a team as code owners January 28, 2025 19:07
@rachelyangdog rachelyangdog marked this pull request as draft January 28, 2025 19:07
@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label Jan 28, 2025
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 28, 2025

Datadog Report

Branch report: rachel.yang/baggage-prop
Commit report: c85eaed
Test service: dd-trace-go

✅ 0 Failed, 5237 Passed, 73 Skipped, 1m 47.69s Total Time

@pr-commenter
Copy link

pr-commenter bot commented Jan 28, 2025

Benchmarks

Benchmark execution time: 2025-02-07 22:24:50

Comparing candidate commit 35ccc89 in PR branch rachel.yang/baggage-prop with baseline commit dbfb8f2 in branch main.

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

scenario:BenchmarkHttpServeTrace-24

  • 🟥 allocated_mem [+297 bytes; +327 bytes] or [+3.087%; +3.389%]
  • 🟥 allocations [+10; +10] or [+12.346%; +12.346%]
  • 🟥 execution_time [+1.217µs; +1.391µs] or [+7.546%; +8.628%]

scenario:BenchmarkStartRequestSpan-24

  • 🟥 allocated_mem [+8 bytes; +8 bytes] or [+3.226%; +3.226%]
  • 🟥 allocations [+1; +1] or [+16.667%; +16.667%]
  • 🟥 execution_time [+46.636ns; +47.644ns] or [+12.695%; +12.969%]

Copy link
Contributor

@mtoffl01 mtoffl01 left a comment

Choose a reason for hiding this comment

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

On the right track, but the new code in StartRequestSpan is causing us to do tracer.Extract twice when we could just do it once. At the same place where we process span links after trace extract (line 127 on your branch, currently), we can also populate a baggagemap with the baggage items found from the returned spanParentCtx. Then, we can push those items onto the request context that we are going to propagate after line 141.

Copy link
Member

@darccio darccio left a comment

Choose a reason for hiding this comment

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

LGTM. Approving this, given @mtoffl01 is going to be applied too.

@rachelyangdog rachelyangdog marked this pull request as ready for review February 7, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:ecosystem contrib/* related feature requests or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants