-
Notifications
You must be signed in to change notification settings - Fork 556
Wrap span restoration in __exit__
in capture_internal_exceptions
#4719
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
Wrap span restoration in __exit__
in capture_internal_exceptions
#4719
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4719 +/- ##
==========================================
- Coverage 84.89% 84.89% -0.01%
==========================================
Files 156 156
Lines 16115 16116 +1
Branches 2741 2741
==========================================
Hits 13681 13681
- Misses 1645 1650 +5
+ Partials 789 785 -4
|
Fixed properly via #4720 |
scope, old_span = self._context_manager_state | ||
del self._context_manager_state | ||
self.finish(scope) | ||
scope.span = old_span |
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.
Bug: Tracing Context Corruption Due to Exception Handling
Wrapping the span's __exit__
cleanup in capture_internal_exceptions()
can silently prevent the scope's active span from being restored, leaving the tracing context inconsistent. If an intermediate cleanup step fails, subsequent critical operations are skipped. Additionally, set_status
is inconsistently outside this block, allowing its internal errors to surface.
Ref #4718
Does not solve the underlying issue and might leave things in an inconsistent state, but it's still preferable to letting an error bubble up to the user.