Skip to content
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

NR-186415 rewrote the persistence in the new event system #190

Closed
wants to merge 11 commits into from

Conversation

mbruin-NR
Copy link
Contributor

The goal of this pr is to add persisted events back to the event manager if they haven't been sent.
I wanted to combine the two events and session attributes persistence layers into one class.
Also I wanted to pass all the tests including the stress tests without the 30 second write time to better match the original.

I have more to write coming soon...

@cdillard-NewRelic
Copy link
Member

Great rewrite, persistent store looks SO much better. Running NRTestApp locally with this changes will add comments on code if issues found.

self = [super init];
if (self) {
events = [[NSMutableArray<NRMAAnalyticEventProtocol> alloc] init];
maxBufferSize = kDefaultBufferSize;
events = [NRMAEventManager getLastSessionEventsArray];
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be behind a feature flag to only happen when offline storage is enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is a good idea to have this as a feature flag but this is separate from offline storage.

Persistence was originally intended to create an event trail for handledExceptions. Now because we believed that events were suppose to persist back into an eventManager and Android agreed they added that and now we should too. This accomplishes the goal of restoring events of an app session that ended unexpectedly.

The way that offline storage currently is CDD'd to work is by storing the data of failed network request into separate files and then sending them all as soon as we send a successful request. There are talks about combining these two things but I haven't heard anything conclusive.

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Attention: 590 lines in your changes are missing coverage. Please review.

Comparison is base (b4d1323) 76.68% compared to head (1ef2247) 76.77%.
Report is 142 commits behind head on develop.

❗ Current head 1ef2247 differs from pull request most recent head dcfdf1b. Consider uploading reports for the commit dcfdf1b to get more accurate results

Files Patch % Lines
Agent/Analytics/NRMAAnalytics.mm 69.60% 190 Missing ⚠️
Agent/Utilities/NRLogger.m 5.71% 66 Missing ⚠️
Agent/HandledException/NRMAHandledExceptions.mm 55.04% 49 Missing ⚠️
Agent/Analytics/NRMASAM.mm 74.05% 48 Missing ⚠️
Agent/Utilities/NRMANetworkMonitor.m 0.00% 40 Missing ⚠️
Agent/Analytics/NRMAEventManager.m 77.16% 29 Missing ⚠️
...trumentation/NSURLSession/NRMAURLSessionOverride.m 72.72% 24 Missing ⚠️
Agent/Harvester/DataStore/NRMAAgentConfiguration.m 32.25% 21 Missing ⚠️
Agent/Network/NRMANetworkFacade.mm 68.25% 20 Missing ⚠️
Agent/UserAction/NRMAUserActionFacade.mm 0.00% 17 Missing ⚠️
... and 14 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #190      +/-   ##
===========================================
+ Coverage    76.68%   76.77%   +0.08%     
===========================================
  Files          167      179      +12     
  Lines        11308    13003    +1695     
===========================================
+ Hits          8672     9983    +1311     
- Misses        2636     3020     +384     

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

@mbruin-NR mbruin-NR marked this pull request as ready for review December 7, 2023 20:42
Copy link
Member

@cdillard-NewRelic cdillard-NewRelic left a comment

Choose a reason for hiding this comment

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

👍

@cdillard-NewRelic
Copy link
Member

Is this PR still valid or needed to be merged or should it be closed?

@mbruin-NR
Copy link
Contributor Author

This PR is half valid. I think the NRMASAM being changed to use the PersistentEventStore is something we want. There are also some other smaller changes that are valid to. However I'm not sure restoring unharvested events to a new session is something we want to do.
I think this pr can be redone in a cleaner way.

@mbruin-NR mbruin-NR closed this Jan 30, 2024
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.

3 participants