-
Notifications
You must be signed in to change notification settings - Fork 539
Fix propagate_scope=False
in ThreadingIntegration
#4310
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
Merged
sl0thentr0py
merged 7 commits into
potel-base
from
ivana/potel/fix-propagate-scope-false
Apr 24, 2025
Merged
Fix propagate_scope=False
in ThreadingIntegration
#4310
sl0thentr0py
merged 7 commits into
potel-base
from
ivana/potel/fix-propagate-scope-false
Apr 24, 2025
Conversation
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## potel-base #4310 +/- ##
==============================================
- Coverage 84.38% 84.35% -0.03%
==============================================
Files 144 144
Lines 14629 14629
Branches 2325 2325
==============================================
- Hits 12345 12341 -4
- Misses 1559 1561 +2
- Partials 725 727 +2
|
antonpirker
approved these changes
Apr 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. But neel should give his blessings :-)
f835a19
to
a964676
Compare
3608b8d
to
99eb066
Compare
sl0thentr0py
approved these changes
Apr 24, 2025
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.
ThreadingIntegration
can optionally NOT propagate scope data to threads (propagate_scope=False
). In that case, in POTel we were wrapping the thread's task in anisolation_scope()
:But as this forks the currently active isolation scope, the thread effectively gets all scope data from the parent isolation scope -- so the scope is actually propagated to the thread, even though it shouldn't be since
propagate_scope=False
.We effectively need some way to give the thread a clear isolation scope instead. In this PR, I'm just clearing the forked iso scope, but I'm not sure if this is good enough and if something doesn't need to be done on the OTel side too.Another option would be to set the iso/current scopes to the initial, empty iso/current scopes instead, before running the thread's target function.UPDATE: we're just instantiating new scopes now
Another change is that in OTel, the spans in the threads, now without a parent, automatically get promoted to transactions. (On master they'd just be orphaned spans, so they wouldn't be taken into account at all.) We probably need to instruct folks to add
only_if_parent
if they don't want this to happen.