feat(android): Add NDK app hang tracking options - #6548
Merged
Conversation
Add enableNdkAppHangTracking and ndkAppHangTimeoutIntervalMillis options, wired through the Android bridge to SentryAndroidOptions, exposing sentry-native's heartbeat-based app-hang detection on Android. Fixes #6546 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
|
📲 Install BuildsAndroid
|
Contributor
iOS (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 68ae91b+dirty | 3834.04 ms | 1216.60 ms | -2617.44 ms |
| 0b5a379+dirty | 3828.91 ms | 1214.12 ms | -2614.79 ms |
| f170ec3+dirty | 3822.26 ms | 1218.33 ms | -2603.93 ms |
| 68672fc+dirty | 3841.58 ms | 1228.89 ms | -2612.69 ms |
| 2c735cc+dirty | 1229.67 ms | 1221.50 ms | -8.17 ms |
| b9bebee+dirty | 3850.15 ms | 1227.51 ms | -2622.64 ms |
| a50b33d+dirty | 1197.74 ms | 1197.17 ms | -0.57 ms |
| 5569641+dirty | 3839.22 ms | 1231.30 ms | -2607.91 ms |
| f9c1ed4+dirty | 3833.98 ms | 1226.30 ms | -2607.68 ms |
| 7ac3378+dirty | 1213.37 ms | 1218.15 ms | 4.78 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 68ae91b+dirty | 4.98 MiB | 6.46 MiB | 1.48 MiB |
| 0b5a379+dirty | 5.15 MiB | 6.70 MiB | 1.54 MiB |
| f170ec3+dirty | 5.15 MiB | 6.69 MiB | 1.53 MiB |
| 68672fc+dirty | 5.15 MiB | 6.71 MiB | 1.55 MiB |
| 2c735cc+dirty | 3.38 MiB | 4.74 MiB | 1.35 MiB |
| b9bebee+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| a50b33d+dirty | 3.38 MiB | 4.73 MiB | 1.35 MiB |
| 5569641+dirty | 5.15 MiB | 6.67 MiB | 1.51 MiB |
| f9c1ed4+dirty | 4.98 MiB | 6.50 MiB | 1.53 MiB |
| 7ac3378+dirty | 3.38 MiB | 4.76 MiB | 1.38 MiB |
Contributor
iOS (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 71abba0+dirty | 3852.70 ms | 1224.53 ms | -2628.16 ms |
| bc0d8cf+dirty | 3834.64 ms | 1223.91 ms | -2610.73 ms |
| 68ae91b+dirty | 3836.36 ms | 1222.04 ms | -2614.32 ms |
| 267d3ed+dirty | 3860.14 ms | 1223.39 ms | -2636.76 ms |
| f170ec3+dirty | 3844.74 ms | 1222.67 ms | -2622.07 ms |
| b9bebee+dirty | 3858.02 ms | 1231.92 ms | -2626.11 ms |
| d038a14+dirty | 3831.11 ms | 1216.30 ms | -2614.81 ms |
| 853723c+dirty | 3849.33 ms | 1221.07 ms | -2628.26 ms |
| e763471+dirty | 3826.10 ms | 1221.52 ms | -2604.58 ms |
| 3d31fcf+dirty | 3857.46 ms | 1237.17 ms | -2620.29 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 71abba0+dirty | 5.15 MiB | 6.67 MiB | 1.52 MiB |
| bc0d8cf+dirty | 5.15 MiB | 6.67 MiB | 1.51 MiB |
| 68ae91b+dirty | 4.98 MiB | 6.46 MiB | 1.48 MiB |
| 267d3ed+dirty | 5.15 MiB | 6.69 MiB | 1.54 MiB |
| f170ec3+dirty | 5.15 MiB | 6.69 MiB | 1.53 MiB |
| b9bebee+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| d038a14+dirty | 5.15 MiB | 6.67 MiB | 1.51 MiB |
| 853723c+dirty | 5.15 MiB | 6.69 MiB | 1.53 MiB |
| e763471+dirty | 4.98 MiB | 6.51 MiB | 1.53 MiB |
| 3d31fcf+dirty | 4.98 MiB | 6.56 MiB | 1.58 MiB |
Contributor
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5a010b7+dirty | 425.62 ms | 469.38 ms | 43.76 ms |
| 1a5721e+dirty | 424.07 ms | 482.32 ms | 58.25 ms |
| 7d8c8bd+dirty | 417.45 ms | 462.10 ms | 44.65 ms |
| 27d9693+dirty | 419.08 ms | 469.12 ms | 50.04 ms |
| ef27341+dirty | 412.94 ms | 443.98 ms | 31.04 ms |
| 41d6254+dirty | 424.45 ms | 474.34 ms | 49.89 ms |
| b9bebee+dirty | 438.86 ms | 452.21 ms | 13.35 ms |
| 3d536d1+dirty | 524.34 ms | 547.32 ms | 22.98 ms |
| 580fb5c+dirty | 436.34 ms | 471.63 ms | 35.28 ms |
| 4e0b819+dirty | 420.56 ms | 470.08 ms | 49.52 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5a010b7+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 1a5721e+dirty | 49.74 MiB | 55.09 MiB | 5.34 MiB |
| 7d8c8bd+dirty | 48.30 MiB | 53.54 MiB | 5.23 MiB |
| 27d9693+dirty | 49.74 MiB | 55.09 MiB | 5.34 MiB |
| ef27341+dirty | 48.30 MiB | 53.54 MiB | 5.24 MiB |
| 41d6254+dirty | 48.30 MiB | 53.60 MiB | 5.30 MiB |
| b9bebee+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 3d536d1+dirty | 49.74 MiB | 55.26 MiB | 5.52 MiB |
| 580fb5c+dirty | 49.74 MiB | 54.79 MiB | 5.05 MiB |
| 4e0b819+dirty | 49.74 MiB | 54.81 MiB | 5.07 MiB |
antonis
commented
Jul 31, 2026
Contributor
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5a010b7+dirty | 475.15 ms | 519.02 ms | 43.88 ms |
| f9c1ed4+dirty | 520.57 ms | 594.84 ms | 74.27 ms |
| c2e182c+dirty | 468.50 ms | 545.44 ms | 76.94 ms |
| 2c735cc+dirty | 435.20 ms | 459.48 ms | 24.28 ms |
| af33f3b+dirty | 417.68 ms | 448.04 ms | 30.37 ms |
| 7d8c8bd+dirty | 406.06 ms | 460.88 ms | 54.81 ms |
| 890d145+dirty | 486.42 ms | 514.85 ms | 28.43 ms |
| ef27341+dirty | 519.02 ms | 553.42 ms | 34.40 ms |
| bf168a4+dirty | 430.60 ms | 459.31 ms | 28.71 ms |
| 41d6254+dirty | 406.20 ms | 445.52 ms | 39.32 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5a010b7+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| f9c1ed4+dirty | 49.74 MiB | 54.86 MiB | 5.12 MiB |
| c2e182c+dirty | 49.74 MiB | 54.85 MiB | 5.11 MiB |
| 2c735cc+dirty | 43.94 MiB | 48.94 MiB | 5.00 MiB |
| af33f3b+dirty | 49.74 MiB | 55.09 MiB | 5.35 MiB |
| 7d8c8bd+dirty | 48.30 MiB | 53.54 MiB | 5.23 MiB |
| 890d145+dirty | 43.94 MiB | 49.00 MiB | 5.06 MiB |
| ef27341+dirty | 48.30 MiB | 53.54 MiB | 5.24 MiB |
| bf168a4+dirty | 49.74 MiB | 55.09 MiB | 5.35 MiB |
| 41d6254+dirty | 48.30 MiB | 53.60 MiB | 5.30 MiB |
3 tasks
antonis
added a commit
to getsentry/sentry-docs
that referenced
this pull request
Aug 28, 2026
…18901) ## DESCRIBE YOUR PR Documents two new Android-only React Native SDK options that surface `sentry-native`'s heartbeat-based app-hang detection: - `enableNdkAppHangTracking` (boolean, default `false`) - `ndkAppHangTimeoutIntervalMillis` (number, default `5000`) Changes: - `configuration/options.mdx` — added `<SdkOption>` entries for both options, next to the other Android options. - `configuration/app-hangs.mdx` — added an "App Hang Tracking on Android" section with init examples, and clarified that the existing `enableAppHangTracking` / `appHangTimeoutInterval` options are iOS-only. Accompanies the SDK change in getsentry/sentry-react-native#6548. ## IS YOUR CHANGE URGENT? - [x] None: Not urgent, can wait up to 1 week+ ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs)⚠️ Should be merged after getsentry/sentry-react-native#6548 is released ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com> Co-authored-by: Alex Krawiec <alexanderkrawiec@gmail.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.
📢 Type of change
📜 Description
Adds two new Android-only options that surface sentry-native's heartbeat-based app-hang detection, introduced upstream in sentry-java
8.48.0:enableNdkAppHangTracking(defaultfalse) →SentryAndroidOptions.setEnableNdkAppHangTrackingndkAppHangTimeoutIntervalMillis(default5000) →SentryAndroidOptions.setNdkAppHangTimeoutIntervalMillisBoth are declared in
BaseReactNativeOptions(JSDoc,@platform android) and wired throughRNSentryStart.getSentryAndroidOptions. The options flow to the native side through the genericinitNativeSdkpath, so no additional bridge plumbing is required.This is independent of the JVM-based ANR detection and mirrors the Capacitor request in getsentry/sentry-capacitor#1351.
💡 Motivation and Context
sentry-react-native did not surface either option — on Android, app-hang tracking was treated as iOS-only. The SDK already bundles
sentry-android8.51.0, so the upstream APIs are available.Fixes #6546
💚 How did you test it?
Added unit tests in
RNSentryStartTest.ktcovering enabled/disabled/default forenableNdkAppHangTrackingand set/default forndkAppHangTimeoutIntervalMillis.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
🤖 Generated with Claude Code