Discard unwanted automatic data earlier where possible #1280
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
Improves performance by discarding unwanted automatic data as early as possible. In the happy case (where an error/session is discarded) then this will remove any overhead from gathering stacktraces/metadata, which should be a significant saving.
Changeset
The changeset has a lot of altered imports/reorganized tests so may be easier to view via the individual commits.
ImmutableConfig
tocom.bugsnag.android.internal
and consolidated all logic for discarding automatically captured data. This involved renaming and documenting some existing methods.ImmutableConfig
public (note it's under theinternal
package)Event
object. This now takes place at the point of error capture, and checks whether theThrowable
itself is within thediscardClasses
or theerrorClass
for ANRs/JS/NDK errorsSession
is instantiated, which avoids the collection of app/device metadata inSessionTracker
Testing
Enhanced unit test coverage for discard logic.
This also relies on the existing E2E tests, specifically
ignored_reports
andrelease_stage
. It's worth noting that these tests aren't exhaustive but are good enough to confirm that the functionality is working correctly.