-
-
Couldn't load subscription status.
- Fork 225
feat: Added SentrySdk.IsSessionActive
#4662
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
base: feat/cache-unhandled-session
Are you sure you want to change the base?
Conversation
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feat/cache-unhandled-session #4662 +/- ##
================================================================
- Coverage 73.21% 73.20% -0.02%
================================================================
Files 479 479
Lines 17370 17374 +4
Branches 3431 3431
================================================================
Hits 12718 12718
- Misses 3803 3807 +4
Partials 849 849 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| public bool IsEnabled => _isEnabled; | ||
|
|
||
| public bool IsSessionActive => _sessionManager.IsSessionActive; |
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.
@bitsandfoxes I'm wondering if what I'm building here might break this (and possibly other stuff):
#4664
Can Unity apps target iOS?
If so, I might need to build an IosSessionManager implementation for ISessionManager... which would be a wrapper around the CocoaSdk session manager.
Thoughts?
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.
Although, I'm also guessing Session Replay isn't a thing in Unity... so maybe a non issue for this particular change.
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.
Unity targets iOS, but sessions are entirely kept and controlled on the C# side of things to keep as close to the user's code as possible. The .NET SDK already allows to pause and resume sessions, I don't see how allowing to check whether a session is active would break things.
Unity SDK integrations pause and resume sessions in response to lifecycle events without knowing if a session is active. This causes repeated warnings from GlobalSessionManager ("Attempted to pause/resume a session, but a session has not been started") with no way for integrations to prevent them.
sentry-dotnet/src/Sentry/GlobalSessionManager.cs
Line 298 in fe09683
This PR adds
IHub.IsSessionActiveto allow checking session state before pause/resume operations. This also gives users insights into whether there currently is a session active. I don't know how else they are supposed to deal any manual session handling anyway.