-
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
Ensure foreground stats are recorded for handled errors #755
Conversation
7c45873
to
f76417f
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.
A few suggestions for consistency in naming, in case we use the data for other things in future.
It seems a little convoluted to encode and decode the JSON when all we're doing is reaching inside the crash context. It also calls this for any report, not just handled.
Did you consider using it directly with bsg_kscrashstate_currentState
from BugsnagClient
? Would it be better to override the AppWithState
fields with this once it's been created for new handled errors only?
…round for handled errors
Updated approach to avoid serialization by getting the information from the KSCrash state directly. This necessitates a small refactor of the logic for updating the duration/durationInForeground fields, which need to be recalculated whenever an error is captured. |
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.
Looks good and works as expected now.
Small quibble over one of the method names and an extraneous declaration.
…oa into fix-foreground-stats
Goal
Ensures that foreground stats are recorded correctly for handled errors. This fixes a bug where
app.inForeground
,app.durationInForeground
, andapp.duration
were captured for unhandled errors but not for handled errors. This is due to the two errors using a different mechanism for capture.Changeset
[BSG_KSCrash captureApplicationStatsInfo]
toBSG_KSSystemInfo
to ensure that application stats are always captured for handled errorsbsg_kscrw_i_writeAppStats
as a JSON string when capturing application statsBSG_ThreadDataBuffer
toBSG_JSONDataBuffer
as the struct can be used as a buffer for both threads + app statsTests
Verified locally in an example app that the fields are now populated.