Skip to content

File system persistence for sessions - #1105

Merged
bruno-garcia merged 20 commits into
mainfrom
cache-sessions
Jul 14, 2021
Merged

bruno-garcia merged 20 commits into
mainfrom
cache-sessions

Conversation

@Tyrrrz

@Tyrrrz Tyrrrz commented Jul 2, 2021

Copy link
Copy Markdown
Contributor

Closes #1096

Comment thread src/Sentry/SentryOptionsExtensions.cs Resolved
Comment thread src/Sentry/Internal/Hub.cs Resolved
@Tyrrrz

Tyrrrz commented Jul 5, 2021

Copy link
Copy Markdown
Contributor Author

Still missing support for special handling of paused sessions (will have to store additional data in the file) and DidCrash handler. But what do you think about the general direction @bruno-garcia?

Comment thread src/Sentry/GlobalSessionManager.cs Resolved
Comment thread src/Sentry/GlobalSessionManager.cs Resolved
Comment thread src/Sentry/GlobalSessionManager.cs Resolved
Comment thread src/Sentry/IJsonSerializable.cs Resolved
Comment thread src/Sentry/SentryOptionsExtensions.cs Resolved
@Tyrrrz

Tyrrrz commented Jul 9, 2021

Copy link
Copy Markdown
Contributor Author

@bruno-garcia some significant changes.
I had to change how the pause/resume works so that it's more encapsulated within session manager, which would allow it to take ownership of the file persistence logic. As a result, it now returns multiple updates from ResumeSession(...) back to Hub. Ugly, but I don't think there are better options since GlobalSessionManager does not encapsulate a reference to ISentryClient (although that wouldn't be a horrible idea maybe?).
Evaluating race conditions and thread contention is a nightmare now, too many variables. Part of me just wants to wrap everything in locks.
What do you think?

Comment thread src/Sentry/GlobalSessionManager.cs Resolved
Comment thread src/Sentry/Internal/Json.cs Resolved
Comment thread src/Sentry/GlobalSessionManager.cs Resolved
@Tyrrrz
Tyrrrz marked this pull request as ready for review July 13, 2021 21:22
@codecov-commenter

codecov-commenter commented Jul 13, 2021 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 72.30769% with 54 lines in your changes missing coverage. Please review.

Project coverage is 80.64%. Comparing base (1b7e3c8) to head (c8dc470).
Report is 1653 commits behind head on main.

Files Patch % Lines
src/Sentry/GlobalSessionManager.cs 74.43% 22 Missing and 12 partials ⚠️
src/Sentry/Internal/Hub.cs 29.16% 16 Missing and 1 partial ⚠️
src/Sentry/SentryOptionsExtensions.cs 71.42% 1 Missing and 1 partial ⚠️
src/Sentry/Internal/Http/CachingTransport.cs 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1105      +/-   ##
==========================================
- Coverage   80.97%   80.64%   -0.33%     
==========================================
  Files         195      197       +2     
  Lines        6422     6582     +160     
  Branches     1417     1452      +35     
==========================================
+ Hits         5200     5308     +108     
- Misses        761      803      +42     
- Partials      461      471      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Tyrrrz
Tyrrrz requested a review from bruno-garcia July 13, 2021 21:27

@bruno-garcia bruno-garcia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small suggestions but LGTM

Comment thread CHANGELOG.md Resolved
Comment thread src/Sentry/GlobalSessionManager.cs Resolved
Comment thread src/Sentry/GlobalSessionManager.cs Resolved
Comment thread src/Sentry/GlobalSessionManager.cs Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache current session information on disk.

3 participants