dd-trace-go
dd-trace-go copied to clipboard
feat(baggage): auto-adding baggage to span tags
What does this PR do?
Automatically adding baggage key-value pairs to span tags with the 'baggage.' prefix. Introducing DD_TRACE_BAGGAGE_TAG_KEYS config. RFC
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.
- [ ] New code is free of linting errors. You can check this by running
golangci-lint runlocally. - [ ] 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!
Datadog Report
Branch report: rachel.yang/adding-baggage-span-tag
Commit report: 374092c
Test service: dd-trace-go
:x: 2 Failed (0 Known Flaky), 4528 Passed, 64 Skipped, 3m 10.45s Total Time
:x: Failed Tests (2)
-
TestBaggageSpanTagsCaseSensitive-github.com/DataDog/dd-trace-go/v2/instrumentation/httptrace- DetailsExpand for error
ailed == RUN TestBaggageSpanTagsCaseSensitive httptrace_test.go:631: baggage.user.id not found in span -- FAIL: TestBaggageSpanTagsCaseSensitive (0.09s) -
TestBaggageSpanTagsExtractionOnly-github.com/DataDog/dd-trace-go/v2/instrumentation/httptrace- DetailsExpand for error
ailed == RUN TestBaggageSpanTagsExtractionOnly httptrace_test.go:662: baggage.user.id not found in span httptrace_test.go:667: baggage.session.id not found in span -- FAIL: TestBaggageSpanTagsExtractionOnly (0.08s)
Benchmarks
Benchmark execution time: 2025-07-15 13:50:37
Comparing candidate commit e9e1d5e08f16b05070467f686da25695f5cdadaa in PR branch rachel.yang/adding-baggage-span-tag with baseline commit b4cbb61826ea2fd41a752c05c2b571787deae6e6 in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics.
Can baggage keys be stringified-numbers, e.g, baggage.Set("12345", "value")? If so, what happens if you set baggage tags of "12345"?
Yes, baggage can be a numbers. According to the RFC,
keys may contain letters, digits, and any of the following characters: ! # $ % & ' * + - . ^ _ ` | ~
If a baggage key-value pair was ("12345", "value"), the corresponding span tag would be ("baggage.12345", "value").
/merge
View all feedbacks in Devflow UI.
2025-07-15 17:35:15 UTC :information_source: Start processing command /merge
2025-07-15 17:35:23 UTC :information_source: MergeQueue: queue is disabled
Added to the queue but the mergequeue is not enabled for now.
2025-07-16 12:10:41 UTC :rotating_light: 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:
- because of branch restrictions, this PR cannot be merged by the mergequeue app. It can only be merged by users or teams apm-ecosystems-reliability
- 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/3440/merge: 405 6 of 6 required status checks are expected. You're not authorized to push to this branch. Visit https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches for more informati [] (Request ID: 6FC3:3C707E:A648A8:15024AB:687796B5)
FullStacktrace: activity error (type: github.GithubService_MergePullRequest, scheduledEventID: 41, startedEventID: 42, identity: 1@github-worker-86d99645c-gmnxf@): PUT https://api.github.com/repos/DataDog/dd-trace-go/pulls/3440/merge: 405 6 of 6 required status checks are expected. You're not authorized to push to this branch. Visit https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches for more informati [] (Request ID: 6FC3:3C707E:A648A8:15024AB:687796B5) (type: GitFailure, retryable: false): PUT https://api.github.com/repos/DataDog/dd-trace-go/pulls/3440/merge: 405 6 of 6 required status checks are expected. You're not authorized to push to this branch. Visit https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches for more informati [] (type: ErrorResponse, retryable: true)
/merge
View all feedbacks in Devflow UI.
2025-07-16 20:45:30 UTC :information_source: Start processing command /merge
2025-07-16 20:45:42 UTC :information_source: MergeQueue: pull request added to the queue
The expected merge time in main is approximately 11m (p90).
2025-07-16 20:59:25 UTC :information_source: MergeQueue: This merge request was merged