-
-
Notifications
You must be signed in to change notification settings - Fork 225
feat: Cache Unhandled session instead of sending it immediately
#4653
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
Merged
Changes from 28 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
c3d01c1
Initial setup
bitsandfoxes 38ac24d
Move terminal state into mechanism
bitsandfoxes 54d3b2f
Format code
getsentry-bot f44a687
Made Terminal nullable
bitsandfoxes de5e1b5
Merge branch 'feat/session-type-unhandled' of https://github.com/gets…
bitsandfoxes b6c4c58
Updated CHANGELOG.md
bitsandfoxes dec8f34
Bump because vulnerability
bitsandfoxes 16179d8
Conditionally add the terminal key
bitsandfoxes 3ecb136
Updated verify
bitsandfoxes d657e0b
merged version6
bitsandfoxes d9c2d73
Cache unhandled sessions instead of sending right away
bitsandfoxes f95bff3
Merge branch 'version6' into feat/session-type-unhandled
bitsandfoxes fac1ab4
Moved 'terminal' into data bag
bitsandfoxes 7a59034
Keep the key
bitsandfoxes 413a9e8
Merge branch 'feat/session-type-unhandled' into feat/cache-unhandled-…
bitsandfoxes 660714e
.
bitsandfoxes 0c47b3f
Updated verify for net48
bitsandfoxes 04d8889
Wrap exception type with enum
bitsandfoxes 4c24f51
Logging
bitsandfoxes bbefdd3
Prevent Mechanism.TerminalKey from being serialized
bitsandfoxes fe4e915
Filter Terminal in WriteTo
bitsandfoxes 31416f9
Make TerminalKey top level but don't serialize
bitsandfoxes 1ad719c
Fixed tests
bitsandfoxes 6508e5e
Pulled unhandled changes into this
bitsandfoxes 4d6fb3f
Replaced API
bitsandfoxes 1348053
Merge branch 'feat/session-type-unhandled' into feat/cache-unhandled-…
bitsandfoxes 624524f
Added net4_8 verify
bitsandfoxes 0502cd7
Merge branch 'feat/session-type-unhandled' into feat/cache-unhandled-…
bitsandfoxes b94c400
Updated CHANGELOG.md
bitsandfoxes 225f67a
Cleanup
bitsandfoxes f06513d
Is this the one that is missing?
bitsandfoxes 7527bdd
Merge branch 'feat/cache-unhandled-session' of https://github.com/get…
bitsandfoxes 01d6bb8
Fixed my own mess. yey.
bitsandfoxes a7ff327
Interlock marking
bitsandfoxes a41b316
Update src/Sentry/Platforms/Android/LogCatAttachmentEventProcessor.cs
bitsandfoxes 352fd01
Merge branch 'version6' into feat/session-type-unhandled
bitsandfoxes a1500c3
Unhandled -> UnhandledTerminal
bitsandfoxes 73a6c01
Apply suggestions from code review
bitsandfoxes 410c373
Merge branch 'feat/session-type-unhandled' into feat/cache-unhandled-…
bitsandfoxes 35784e6
Merge branch 'feat/cache-unhandled-session' of https://github.com/get…
bitsandfoxes 1a72f29
Fix import and persist unhandled mark when pausing
bitsandfoxes 32bf6d2
Merged 'version6'
bitsandfoxes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,15 +45,17 @@ public SentryEvent Process(SentryEvent @event, SentryHint hint) | |
|
|
||
| try | ||
| { | ||
| if (_logCatIntegrationType != LogCatIntegrationType.All && [email protected]()) | ||
| var exceptionType = @event.GetExceptionType(); | ||
|
|
||
| if (_logCatIntegrationType != LogCatIntegrationType.All && exceptionType == SentryEvent.ExceptionType.None) | ||
| { | ||
| return @event; | ||
| } | ||
|
|
||
| // Only send logcat logs if the event is unhandled if the integration is set to Unhandled | ||
| if (_logCatIntegrationType == LogCatIntegrationType.Unhandled) | ||
| { | ||
| if ([email protected]()) | ||
| if (exceptionType != SentryEvent.ExceptionType.Unhandled) | ||
| { | ||
| return @event; | ||
| } | ||
|
|
||
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,13 @@ public class SentrySession : ISentrySession | |
| // Start at -1 so that the first increment puts it at 0 | ||
| private int _sequenceNumber = -1; | ||
|
|
||
| private bool _hasPendingUnhandledException; | ||
|
|
||
| /// <summary> | ||
| /// Gets whether this session has an unhandled exception that hasn't been finalized yet. | ||
| /// </summary> | ||
| internal bool HasPendingUnhandledException => _hasPendingUnhandledException; | ||
|
|
||
| internal SentrySession( | ||
| SentryId id, | ||
| string? distinctId, | ||
|
|
@@ -74,6 +81,16 @@ public SentrySession(string? distinctId, string release, string? environment) | |
| /// </summary> | ||
| public void ReportError() => Interlocked.Increment(ref _errorCount); | ||
|
|
||
| /// <summary> | ||
| /// Marks the session as having an unhandled exception without ending it. | ||
| /// This allows the session to continue and potentially escalate to Crashed if the app crashes. | ||
| /// </summary> | ||
| internal void MarkUnhandledException() | ||
| { | ||
| _hasPendingUnhandledException = true; | ||
| ReportError(); | ||
| } | ||
bitsandfoxes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| internal SessionUpdate CreateUpdate( | ||
| bool isInitial, | ||
| DateTimeOffset timestamp, | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.