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

fix: Support adding pre-delivery metadata to OOM reports #393

Merged
merged 1 commit into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
=========

* Support adding pre-delivery metadata to out-of-memory reports
[#393](https://github.com/bugsnag/bugsnag-cocoa/pull/393)

## 5.22.3 (2019-07-15)

This release disables reporting out-of-memory events in debug mode, to reduce
Expand Down
1 change: 1 addition & 0 deletions Source/BugsnagCrashReport.m
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ - (instancetype)initWithKSReport:(NSDictionary *)report
_releaseStage = [report valueForKeyPath:@"user.state.oom.app.releaseStage"];
_handledState = [BugsnagHandledState handledStateWithSeverityReason:LikelyOutOfMemory];
_deviceAppHash = [report valueForKeyPath:@"user.state.oom.device.id"];
_metaData = [NSMutableDictionary new];
NSDictionary *sessionData = [report valueForKeyPath:@"user.state.oom.session"];
if (sessionData) {
_session = [[BugsnagSession alloc] initWithDictionary:sessionData];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ @implementation OOMScenario
- (void)startBugsnag {
self.config.shouldAutoCaptureSessions = NO;
self.config.releaseStage = @"alpha";
[self.config addBeforeSendBlock:^bool(NSDictionary * _Nonnull rawEventData, BugsnagCrashReport * _Nonnull report) {
NSMutableDictionary *metadata = [report.metaData mutableCopy];
metadata[@"extra"] = @{ @"shape": @"line" };
report.metaData = metadata;
return YES;
}];
[super startBugsnag];
}

Expand Down
1 change: 1 addition & 0 deletions features/out_of_memory.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Feature: Reporting out of memory events
And the event "app.releaseStage" equals "beta"
And the event "app.version" equals "1.0.3"
And the event "app.bundleVersion" equals "5"
And the event "metaData.extra.shape" equals "line"
And the event breadcrumbs contain "Crumb left before crash"

Scenario: The OS kills the application in the background
Expand Down