Skip to content

ios: flush stats on background / termination#709

Closed
rebello95 wants to merge 1 commit intoexpose-flushfrom
ios-flush
Closed

ios: flush stats on background / termination#709
rebello95 wants to merge 1 commit intoexpose-flushfrom
ios-flush

Conversation

@rebello95
Copy link
Copy Markdown
Contributor

Builds on #707 by consuming this interface to flush stats when the app is backgrounded or terminated. This will help ensure that stats are sent to the server when possible before the app potentially loses its in-memory stats cache.

Part of #573.

Signed-off-by: Michael Rebello [email protected]

Builds on #707 by consuming this interface to flush stats when the app is backgrounded or terminated. This will help ensure that stats are sent to the server when possible before the app potentially loses its in-memory stats cache.

Part of #573.

Signed-off-by: Michael Rebello <[email protected]>
@rebello95 rebello95 requested a review from junr03 February 27, 2020 23:40
@rebello95
Copy link
Copy Markdown
Contributor Author

Going with a bit of a different approach, so ignore this PR for now 😄

@rebello95 rebello95 added the work in progress Not yet ready for review label Feb 29, 2020
+ (void)startFlushingStatsOnLifecycleChanges {
static dispatch_once_t lifecycleMonitoringStarted;
dispatch_once(&lifecycleMonitoringStarted, ^{
[self startObservingLifecycleNotifications];
Copy link
Copy Markdown
Contributor

@goaway goaway Mar 2, 2020

Choose a reason for hiding this comment

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

nit: I feel sort of like startObservingLifecycleNotification should be the public method name, since the fact that we're flushing stats on them seems more like an implementation detail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can rename

}

+ (void)lifecycleDidChangeWithNotification:(NSNotification *)notification {
NSLog(@"[Envoy] triggering stats flush (%@)", notification.name);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this meant to be here? (Do we generally utilize NSLog in our platform layer? Is it normal for third-part libraries to do so?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We have several of these at the moment. @junr03 and I briefly discussed the possibility of using ENVOY_LOG rather than NSLog (which would be much nicer), but it'd require the native layer to depend on upstream Envoy code directly which would be a bit of a shift. Opened an issue for this here: #719

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sounds good, and thanks for opening the issue.

@rebello95
Copy link
Copy Markdown
Contributor Author

Replacing with #717

@rebello95 rebello95 closed this Mar 3, 2020
@rebello95 rebello95 deleted the ios-flush branch March 3, 2020 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

work in progress Not yet ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants