dd-trace-go
dd-trace-go copied to clipboard
feat(ddtrace/tracer): introduce ExtractCtx to support propagated context
What does this PR do?
Adds ExtractCtx to simplify the creation of child spans from propagated contexts.
Some notes:
- All the functions are unexported except for
ExtractCtxto reduce the increase on public API. - We are still relying in the deprecated
ChildOfinternally, which expects aSpanContext, so instead of reusing the existingActiveSpanKeywe create a new one forActiveSpanContextKey(which it doesn't have precedence overActiveSpanKeyvalue).
Motivation
Fixes #3793
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
./scripts/lint.shlocally. - [ ] 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!
Benchmarks
Benchmark execution time: 2025-08-13 09:29:15
Comparing candidate commit 831161b785a318b5e133b40f776dd6f76818ce0b in PR branch dario.castane/langplat-727/extract-ctx with baseline commit 4d47dd60c2c81734d85ba67d74d643a77e86d29e in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics.