Skip to content

feat(samples): Make Android error buttons identifiable in Sentry#5722

Merged
runningcode merged 1 commit into
mainfrom
no/samples-android-identify-events
Jul 6, 2026
Merged

feat(samples): Make Android error buttons identifiable in Sentry#5722
runningcode merged 1 commit into
mainfrom
no/samples-android-identify-events

Conversation

@runningcode

@runningcode runningcode commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

📜 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:

  • Tags its event with sample_action=<button key> (reusing the existing SentryTraced keys, e.g. capture_exception, send_message) via a small tagSampleAction() helper, so events can be filtered/grouped in Sentry.
  • Uses distinctive text that names the button (e.g. "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

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

None.

#skip-changelog

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>
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 3f4df9c

@sentry

sentry Bot commented Jul 6, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.47.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 339.53 ms 458.38 ms 118.85 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

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
runningcode marked this pull request as ready for review July 6, 2026 11:28
@linear-code

linear-code Bot commented Jul 6, 2026

Copy link
Copy Markdown

JAVA-631

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

@runningcode
runningcode enabled auto-merge (squash) July 6, 2026 11:47
@runningcode
runningcode merged commit 6134075 into main Jul 6, 2026
36 of 38 checks passed
@runningcode
runningcode deleted the no/samples-android-identify-events branch July 6, 2026 12:17
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.

2 participants