-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add fallback metadata in the event of report file corruption #327
Conversation
d272aed
to
6911165
Compare
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.
Didn't have time to do a comprehensive review, but I've left a few comments about what I managed to go through so far. Mostly this looks like a good approach! I wasn't able to run anything locally due to time constraints.
|
||
|
||
if ([self isIncomplete]) { | ||
BSGDictSetSafeObject(event, @YES, BSGKeyIncomplete); |
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.
Do we want to include the field if it's false
also? This would allow filtering on the value either way
@@ -620,6 +645,42 @@ - (NSString *_Nullable)enhancedErrorMessageForThread:(NSDictionary *_Nullable)th | |||
|
|||
@end | |||
|
|||
@implementation FallbackReportData | |||
|
|||
- (instancetype)initWithMetadata:(NSString *)metadata { |
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.
It'd be nice to separate this out into individual methods to improve readability (e.g. one that returns the severity, another that returns the handled state, etc).
Source/KSCrash/Source/KSCrash/Recording/Sentry/BSG_KSCrashSentry_Deadlock.m
Show resolved
Hide resolved
Source/KSCrash/Source/KSCrash/Recording/Sentry/BSG_KSCrashSentry_Signal.c
Show resolved
Hide resolved
Source/KSCrash/Source/KSCrash/Recording/Sentry/BSG_KSCrashSentry_User.c
Outdated
Show resolved
Hide resolved
6911165
to
e849ff2
Compare
This change formats report file names to include minimal metadata: * Add accessor for report contents indexed by filename * Add async-safe customized filepath generator * Update the callbacks to explicitly include the report count Incomplete reports have been corrupted or otherwise could not be written, and thus have no content in the report data dictionary. Fallback values are parsed from the file name metadata and used as needed without depending on an individual value to determine "incomplete-ness".
e849ff2
to
fdb769b
Compare
The change to filenames means that both crashes can now be reported since they will use different paths and avoid overwriting the other.
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.
Looking through the changes, it seems OK to me but I'm not very familiar with codebase. Tried this locally by forcing the reports to be incomplete in various ways with various exceptions. Verified that the incomplete flag is set properly in the pipeline. LGTM once the tests pass
Goal
Capture and report basic report metadata in the event that a crash report file is corrupted or otherwise could not be written.
Design
The file path calculation logic is altered to include the severity, handled-ness, and first few characters of the error class, which are parsed and used in the event that the file cannot be read.
This change refactors the
sendReports
/filterReports
parameter types to include the file path, which required some alteration to theSink
andApiClient
callback type signatures since an array was no longer being passed around (and we only used the count of the array anyhow).Tests