fix(android): Backfill pre-init ANR and native crash metadata#5762
Open
romtsn wants to merge 4 commits into
Open
fix(android): Backfill pre-init ANR and native crash metadata#5762romtsn wants to merge 4 commits into
romtsn wants to merge 4 commits into
Conversation
Use current options when persisted values are missing and the app has not been updated since the exit. Avoid attributing historical crashes to a newer app version.
📲 Install BuildsAndroid
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b019b7 | 403.90 ms | 546.09 ms | 142.19 ms |
| e63ad34 | 310.20 ms | 366.84 ms | 56.63 ms |
| 5865051 | 319.74 ms | 365.60 ms | 45.86 ms |
| a1eadfa | 345.67 ms | 411.26 ms | 65.59 ms |
| b193867 | 319.59 ms | 403.09 ms | 83.50 ms |
| 0eaac1e | 316.82 ms | 357.34 ms | 40.52 ms |
| 22ff2c7 | 306.60 ms | 336.65 ms | 30.05 ms |
| d15471f | 286.65 ms | 314.68 ms | 28.03 ms |
| 05aa61d | 310.43 ms | 372.40 ms | 61.97 ms |
| fcec2f2 | 311.35 ms | 384.94 ms | 73.59 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b019b7 | 0 B | 0 B | 0 B |
| e63ad34 | 0 B | 0 B | 0 B |
| 5865051 | 0 B | 0 B | 0 B |
| a1eadfa | 0 B | 0 B | 0 B |
| b193867 | 1.58 MiB | 2.19 MiB | 620.00 KiB |
| 0eaac1e | 1.58 MiB | 2.19 MiB | 619.17 KiB |
| 22ff2c7 | 0 B | 0 B | 0 B |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 05aa61d | 0 B | 0 B | 0 B |
| fcec2f2 | 1.58 MiB | 2.12 MiB | 551.51 KiB |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4555c88. Configure here.
Populate app version and build for historical ANR and native crash events when the current package metadata is safe to use. Co-Authored-By: Codex <noreply@openai.com>
Backfill only app version and build for historical exits. Avoid attaching current localized app names, identifiers, or split APK state to older events. Co-Authored-By: Codex <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

📜 Description
Backfill release, environment, distribution (
dist), and app version/build on ANR and native crash events from the current SDK options when persisted values are unavailable.This covers exits that happen before SDK initialization, when the SDK has not yet persisted those options. Current values are used only when the app has not been updated since the exit. A missing or invalid package update timestamp is treated conservatively so historical events are not attributed to a newer app version.
💡 Motivation and Context
ANR and native crash events are reported from
ApplicationExitInfoon the next SDK initialization. If the terminated process exited before initializing the SDK, release-related options were never persisted and the reported event can be missing useful metadata.The reporting process already has the same values in its current options when the package has not been updated. Comparing the exit timestamp with
PackageInfo.lastUpdateTimeallows those values to be used without attaching metadata from a newer app version.Closes #4227
Closes #3287
💚 How did you test it?
./gradlew ':sentry-android-core:testDebugUnitTest' --tests='*ApplicationExitInfoEventProcessorTest*' --info(42 tests passed)./gradlew spotlessApply apiDump📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.