feat(samples): Make Android error buttons identifiable in Sentry#5722
Merged
Conversation
Every button on the sample app's Errors tab sent generic, indistinguishable events (e.g. two buttons both threw "Uncaught Exception from Java." and "Send Message" sent "Some message."), so there was no way to tell which button produced which event in Sentry. Each Errors button now tags its event with sample_action=<button key> (reusing the existing SentryTraced keys) and uses distinctive text that names the button. Buttons whose crash carries no message (stack overflow, OOM, native) are still identifiable via the tag. The native captured message is likewise renamed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
📲 Install BuildsAndroid
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3d205d0 | 352.15 ms | 432.53 ms | 80.38 ms |
| e59e22a | 368.02 ms | 432.00 ms | 63.98 ms |
| 806307f | 357.85 ms | 424.64 ms | 66.79 ms |
| d364ace | 384.53 ms | 453.51 ms | 68.98 ms |
| 4c04bb8 | 307.93 ms | 362.34 ms | 54.41 ms |
| bb0ff41 | 312.86 ms | 363.78 ms | 50.92 ms |
| 91bb874 | 310.68 ms | 359.24 ms | 48.56 ms |
| 11f90db | 314.26 ms | 372.43 ms | 58.17 ms |
| f6cdbf0 | 314.19 ms | 357.59 ms | 43.40 ms |
| 8687935 | 332.52 ms | 362.23 ms | 29.71 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3d205d0 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
| e59e22a | 1.58 MiB | 2.20 MiB | 635.34 KiB |
| 806307f | 1.58 MiB | 2.10 MiB | 533.42 KiB |
| d364ace | 1.58 MiB | 2.11 MiB | 539.75 KiB |
| 4c04bb8 | 0 B | 0 B | 0 B |
| bb0ff41 | 0 B | 0 B | 0 B |
| 91bb874 | 1.58 MiB | 2.13 MiB | 559.07 KiB |
| 11f90db | 0 B | 0 B | 0 B |
| f6cdbf0 | 0 B | 0 B | 0 B |
| 8687935 | 1.58 MiB | 2.19 MiB | 619.17 KiB |
runningcode
marked this pull request as ready for review
July 6, 2026 11:28
runningcode
requested review from
0xadam-brown,
adinauer,
markushi and
romtsn
as code owners
July 6, 2026 11:28
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.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3f4df9c. Configure here.
markushi
approved these changes
Jul 6, 2026
runningcode
enabled auto-merge (squash)
July 6, 2026 11:47
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
Makes every button on the sample app's Errors tab produce an event that is easy to identify in Sentry.
Previously the events were generic and indistinguishable — for example, two different buttons both threw
RuntimeException("Uncaught Exception from Java."), and "Send Message" sent"Some message.". There was no reliable way to tell which button produced which event.Now each Errors button:
sample_action=<button key>(reusing the existingSentryTracedkeys, e.g.capture_exception,send_message) via a smalltagSampleAction()helper, so events can be filtered/grouped in Sentry."Send Message button: test message","Capture Exception button: nested exception").Buttons whose crash carries no message (Stack Overflow, Out of Memory, Native Crash) are still identifiable via the tag. The native captured message text is likewise renamed to
"Native Capture button: native message".The tag is set on the persistent scope so uncaught crashes still carry it when the crash handler processes them later.
💡 Motivation and Context
When using the sample app to generate test data, it was impossible to correlate a Sentry issue back to the button that triggered it. This makes the sample app far more useful for manually verifying crash/exception/message/breadcrumb/log capture.
Relates to JAVA-631 — this does not complete the Android 17 smoke-test checklist, but makes the crash / native-crash / message verification steps easier to carry out.
💚 How did you test it?
./gradlew :sentry-samples:sentry-samples-android:spotlessApply apiDump— clean, no API changes../gradlew :sentry-samples:sentry-samples-android:assembleDebug— builds successfully (Kotlin + C++ compile).📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.
#skip-changelog