Return null from TracerShim extract when the carrier has no span context - #8505
Merged
jack-berg merged 2 commits intoJul 13, 2026
Merged
Conversation
thswlsqls
force-pushed
the
fix/tracershim-extract-empty-carrier-null
branch
from
June 22, 2026 08:03
104cdd4 to
2c22bed
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8505 +/- ##
============================================
+ Coverage 91.60% 91.61% +0.01%
- Complexity 10312 10314 +2
============================================
Files 1013 1013
Lines 27274 27274
Branches 3202 3202
============================================
+ Hits 24983 24986 +3
+ Misses 1563 1562 -1
+ Partials 728 726 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
jack-berg
approved these changes
Jul 13, 2026
Contributor
|
Thank you for your contribution @thswlsqls! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4344
Description
Propagation.extractTextMapusedContext.current()as the extract parent. ATextMapPropagatorreturns the input context unchanged when the carrier has no valid headers, so an empty-carrier extract with an active span returned that span as a non-nullSpanContextShim.Tracer#extractcontract: with no serialized span state in the carrier, the result must be null.Context.root()makes extraction depend only on the carrier. A populated carrier decodes exactly as before;injectis left unchanged (preserving the current context there is intended).Testing done
TracerShimTest#extract_emptyCarrier_withActiveSpan_returnsNull(fails before the change, passes after)../gradlew :opentracing-shim:check— 83 tests passed.## Unreleased### Shimsentry inCHANGELOG.md. No public API change (apidiff unaffected;Propagation/TracerShimare package-private).