feat(scopes): Add sentry_scope_clear()#1881
Merged
Merged
Conversation
|
limbonaut
commented
Jul 17, 2026
Comment on lines
+221
to
+222
| // Keep the propagation and dynamic sampling contexts across clears so | ||
| // telemetry captured afterwards continues on the same trace. |
Collaborator
Author
There was a problem hiding this comment.
I aligned this implementation with Cocoa and Android. I didn't find much details on scope.clear() in the specs, so borrowed this part from other SDKs.
spec: Reset scope to defaults, keeping event processors.
It makes sense that the scope.clear() doesn't drop trace defaults.
Collaborator
Author
There was a problem hiding this comment.
In the current shape, this is close to no-op, because user-created scopes carry no default trace, and it's picked up from the global scope instead. But this may change if we introduce propagation context mutators.
jpnurmi
approved these changes
Jul 17, 2026
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1881 +/- ##
==========================================
+ Coverage 75.56% 75.60% +0.04%
==========================================
Files 90 90
Lines 21169 21188 +19
Branches 3763 3764 +1
==========================================
+ Hits 15996 16020 +24
+ Misses 4346 4333 -13
- Partials 827 835 +8 🚀 New features to boost your workflow:
|
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.
Adds
sentry_scope_clear, which resets the given scope data (user, tags, breadcrumbs, attributes, and so on) to a fresh state while keeping its trace, so a reusable scope can be cleared and used again.