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

Report internal SDK errors to bugsnag #570

Merged
merged 12 commits into from
Aug 27, 2019
Merged

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Aug 22, 2019

Goal

Rather than sending minimal error reports, the SDK now reports internal SDK errors to bugsnag
instead in a way that does not route them to customer dashboards. A minimal report is generated
which is not altered in callbacks and is not cached to disk.

Changeset

  • Updated ErrorStore to inform a delegate of an exception, rather than creating an error from the filename
  • Removed sending of minimal error reports and associated tests
  • Updated onErrorReadFailure() to add metadata to a generated error about the file being read, and then report an internal error to bugsnag
  • Added reportInternalBugsnagError(), which sends an error report that is picked up by Bugsnag's internal monitoring
  • Send minimal app/device data in internal error reports, along with some metadata about the exception
  • Avoid running callbacks, caching internal error reports to disk, or reattempting delivery

Note: in order to alter the headers on a per-request basis, DefaultDelivery must be used as the delivery mechanism, as otherwise we'd need to make a breaking change to the delivery signature. If a user has specified a custom Delivery mechanism we're unable to send these reports. This API limitation has already been rectified in the immutable config work where we can specify different headers for individual requests

Tests

  • Manually inspected payload
  • Sent payload to dashboard (by temporarily altering changeset to add an API key)
  • Added a mazerunner scenario to verify internal error reports are sent

Rather than sending minimal error reports, the SDK now reports internal SDK errors to bugsnag
instead in a way that does not route them to customer dashboards. A minimal report is generated
which is not altered in callbacks and is not cached to disk.
Copy link
Contributor

@kattrali kattrali left a 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 in my testing. 👍 For future proofing, I think the test could better reflect the case(s) we want to handle. A good rule would be that we (generally) shouldn't need to call an internal API from a functional test, though I recognize that there isn't a direct way to flush reports at the moment.

@fractalwrench
Copy link
Contributor Author

I've updated the mazerunner scenario so that it now creates an empty file in the reports directory, which will trigger an internal error report.

@bengourley
Copy link
Contributor

bengourley commented Aug 23, 2019

I tested the following permutations and all exhibited the expected outcomes:

Case Outcome  Expected
Empty file in the bugsnag-errors directory Sent java.io.EOFException to internal dashboard
Invalid JSON file in bugsnag-errors directory Sent android.util.MalformedJsonException to internal dashboard
Valid JSON with no errors in bugsnag-errors directory Sent java.io.IOException to internal dashboard
Missing stacktrace Sent the stack-less exception to normal dashboard
Errors stored on disk from previous version 4.18.0 Sent errors to normal dashboard successfully

@fractalwrench fractalwrench merged commit 3a3f24c into master Aug 27, 2019
@fractalwrench fractalwrench deleted the internal-reporting branch August 27, 2019 09:00
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.

4 participants