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

Opentelemetry Baggage Propagation #3126

Merged
merged 22 commits into from
Feb 14, 2025
Merged

Opentelemetry Baggage Propagation #3126

merged 22 commits into from
Feb 14, 2025

Conversation

rachelyangdog
Copy link
Contributor

@rachelyangdog rachelyangdog commented Jan 28, 2025

What does this PR do?

  • I've added support for propagating baggage on the only http client-side integration (net/http’s roundtripper.go)
  • I've added support for propagating baggage for most server-side HTTP integrations (the ones that use httptrace.go to generate their spans)
  • I've added "baggage" as part of the default propagators

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: 76bd3f5
Test service: dd-trace-go

✅ 0 Failed, 5246 Passed, 73 Skipped, 2m 1.97s Total Time

@pr-commenter
Copy link

pr-commenter bot commented Jan 28, 2025

Benchmarks

Benchmark execution time: 2025-02-13 19:45:19

Comparing candidate commit 3c6ea6d in PR branch rachel.yang/baggage-prop with baseline commit c345adb in branch main.

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

scenario:BenchmarkHttpServeTrace-24

  • 🟥 allocated_mem [+307 bytes; +335 bytes] or [+3.193%; +3.481%]
  • 🟥 allocations [+10; +10] or [+12.346%; +12.346%]
  • 🟥 execution_time [+1.047µs; +1.171µs] or [+6.430%; +7.194%]

scenario:BenchmarkSetTagMetric-24

  • 🟩 execution_time [-4.445ns; -2.715ns] or [-3.619%; -2.210%]

scenario:BenchmarkStartRequestSpan-24

  • 🟥 allocated_mem [+8 bytes; +8 bytes] or [+3.226%; +3.226%]
  • 🟥 allocations [+1; +1] or [+16.667%; +16.667%]
  • 🟥 execution_time [+48.549ns; +49.431ns] or [+13.374%; +13.617%]

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
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.

Approved, but with the following notes:

  1. Update the PR title
  2. Update the PR description to specify what exactly is in scope in this PR. In short, you've added support for propagating baggage with HTTP headers in net/http client and all http integrations that use httptrace.go to generate their spans. More info in this little doc I put together: https://docs.google.com/document/d/1Te1L6QKzQpbtNMqe_KD3YXPTzcP-AZCSUJ44NlVNHII/edit?tab=t.0

@rachelyangdog rachelyangdog changed the title WIP: Baggage Propagation Opentelemetry Baggage Propagation Feb 10, 2025
@rachelyangdog
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Feb 13, 2025

View all feedbacks in Devflow UI.
2025-02-13 18:45:09 UTC ℹ️ Start processing command /merge


2025-02-13 18:45:17 UTC ℹ️ MergeQueue: pull request added to the queue

The median merge time in main is 0s.


2025-02-13 19:01:46 UTC 🚨 MergeQueue: This merge request is in error

mergequeue build completed successfully, but the github api returned an error while merging the pr.
It's probably because:

  • target branch of PR is restricted to only allow up-to-date branches, but the pr is now outdated
Details

Error: PUT https://api.github.com/repos/DataDog/dd-trace-go/pulls/3126/merge: 405 5 of 5 required status checks are expected. []

FullStacktrace:
activity error (type: github.GithubService_MergePullRequest, scheduledEventID: 41, startedEventID: 42, identity: 1@github-worker-575b699795-26xsc@): PUT https://api.github.com/repos/DataDog/dd-trace-go/pulls/3126/merge: 405 5 of 5 required status checks are expected. [] (type: GitFailure, retryable: false): PUT https://api.github.com/repos/DataDog/dd-trace-go/pulls/3126/merge: 405 5 of 5 required status checks are expected. [] (type: ErrorResponse, retryable: true)

@bm1549 bm1549 merged commit f5514e1 into main Feb 14, 2025
173 checks passed
@bm1549 bm1549 deleted the rachel.yang/baggage-prop branch February 14, 2025 19:22
hannahkm pushed a commit that referenced this pull request Feb 14, 2025
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 mergequeue-status: error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants