feat(android): Add NDK app hang tracking options - #6548
Open
antonis wants to merge 4 commits into
Open
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 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
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 |
|---|---|---|---|
| 61cc206+dirty | 3849.70 ms | 1230.33 ms | -2619.38 ms |
| 5a21b51+dirty | 3823.11 ms | 1214.46 ms | -2608.65 ms |
| 038a6d7+dirty | 3849.69 ms | 1228.40 ms | -2621.28 ms |
| 3817909+dirty | 1183.90 ms | 1187.50 ms | 3.60 ms |
| d7d54c6+dirty | 3827.13 ms | 1217.18 ms | -2609.95 ms |
| 0bd8916+dirty | 3842.33 ms | 1230.76 ms | -2611.58 ms |
| a0d8cf8+dirty | 3842.33 ms | 1212.40 ms | -2629.93 ms |
| af33f3b+dirty | 3849.98 ms | 1236.45 ms | -2613.53 ms |
| 5a316ea+dirty | 3820.11 ms | 1211.28 ms | -2608.83 ms |
| 7a89652+dirty | 3861.46 ms | 1229.61 ms | -2631.85 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 61cc206+dirty | 4.98 MiB | 6.55 MiB | 1.57 MiB |
| 5a21b51+dirty | 5.15 MiB | 6.67 MiB | 1.51 MiB |
| 038a6d7+dirty | 5.15 MiB | 6.70 MiB | 1.55 MiB |
| 3817909+dirty | 3.38 MiB | 4.73 MiB | 1.35 MiB |
| d7d54c6+dirty | 4.98 MiB | 6.51 MiB | 1.53 MiB |
| 0bd8916+dirty | 5.15 MiB | 6.69 MiB | 1.53 MiB |
| a0d8cf8+dirty | 5.15 MiB | 6.67 MiB | 1.51 MiB |
| af33f3b+dirty | 4.98 MiB | 6.51 MiB | 1.54 MiB |
| 5a316ea+dirty | 4.98 MiB | 6.51 MiB | 1.53 MiB |
| 7a89652+dirty | 5.15 MiB | 6.70 MiB | 1.55 MiB |
Contributor
iOS (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 61cc206+dirty | 3822.60 ms | 1206.17 ms | -2616.43 ms |
| b9bebee+dirty | 3858.02 ms | 1231.92 ms | -2626.11 ms |
| 2363c0f+dirty | 3834.61 ms | 1224.46 ms | -2610.15 ms |
| 038a6d7+dirty | 3838.96 ms | 1218.86 ms | -2620.10 ms |
| 7ff4d0f+dirty | 3859.87 ms | 1224.75 ms | -2635.12 ms |
| d7d54c6+dirty | 3842.44 ms | 1204.87 ms | -2637.57 ms |
| 1122a96+dirty | 3839.17 ms | 1219.23 ms | -2619.93 ms |
| 23598c3+dirty | 1223.59 ms | 1229.13 ms | 5.53 ms |
| af33f3b+dirty | 3851.28 ms | 1233.06 ms | -2618.21 ms |
| 5a316ea+dirty | 3831.56 ms | 1214.31 ms | -2617.26 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 61cc206+dirty | 4.98 MiB | 6.55 MiB | 1.57 MiB |
| b9bebee+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| 2363c0f+dirty | 4.98 MiB | 6.46 MiB | 1.49 MiB |
| 038a6d7+dirty | 5.15 MiB | 6.70 MiB | 1.55 MiB |
| 7ff4d0f+dirty | 5.15 MiB | 6.70 MiB | 1.55 MiB |
| d7d54c6+dirty | 4.98 MiB | 6.51 MiB | 1.53 MiB |
| 1122a96+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| 23598c3+dirty | 3.38 MiB | 4.80 MiB | 1.42 MiB |
| af33f3b+dirty | 4.98 MiB | 6.51 MiB | 1.54 MiB |
| 5a316ea+dirty | 4.98 MiB | 6.51 MiB | 1.53 MiB |
Contributor
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5257d80+dirty | 423.37 ms | 467.54 ms | 44.17 ms |
| 3d536d1+dirty | 524.34 ms | 547.32 ms | 22.98 ms |
| 7d6fd3a+dirty | 403.02 ms | 422.56 ms | 19.54 ms |
| 0b1b5e3+dirty | 416.42 ms | 470.58 ms | 54.16 ms |
| 64630e5+dirty | 419.18 ms | 464.58 ms | 45.40 ms |
| 21a1e70+dirty | 405.72 ms | 436.16 ms | 30.44 ms |
| 5a21b51+dirty | 471.42 ms | 524.22 ms | 52.80 ms |
| f3215d3+dirty | 411.11 ms | 454.38 ms | 43.27 ms |
| 9210ae6+dirty | 475.41 ms | 525.24 ms | 49.84 ms |
| 3b6e9f9+dirty | 442.70 ms | 486.44 ms | 43.74 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5257d80+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 3d536d1+dirty | 49.74 MiB | 55.26 MiB | 5.52 MiB |
| 7d6fd3a+dirty | 43.75 MiB | 48.14 MiB | 4.39 MiB |
| 0b1b5e3+dirty | 48.30 MiB | 53.60 MiB | 5.29 MiB |
| 64630e5+dirty | 49.74 MiB | 54.82 MiB | 5.07 MiB |
| 21a1e70+dirty | 49.74 MiB | 54.82 MiB | 5.07 MiB |
| 5a21b51+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
| f3215d3+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
| 9210ae6+dirty | 48.30 MiB | 53.54 MiB | 5.23 MiB |
| 3b6e9f9+dirty | 48.30 MiB | 53.54 MiB | 5.23 MiB |
antonis
commented
Jul 31, 2026
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