Skip to content

feat(android): Add NDK app hang tracking options - #6548

Open
antonis wants to merge 4 commits into
mainfrom
feat/android-ndk-app-hang-tracking
Open

feat(android): Add NDK app hang tracking options#6548
antonis wants to merge 4 commits into
mainfrom
feat/android-ndk-app-hang-tracking

Conversation

@antonis

@antonis antonis commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 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 (default false) → SentryAndroidOptions.setEnableNdkAppHangTracking
  • ndkAppHangTimeoutIntervalMillis (default 5000) → SentryAndroidOptions.setNdkAppHangTimeoutIntervalMillis

Both are declared in BaseReactNativeOptions (JSDoc, @platform android) and wired through RNSentryStart.getSentryAndroidOptions. The options flow to the native side through the generic initNativeSdk path, 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-android 8.51.0, so the upstream APIs are available.

Fixes #6546

💚 How did you test it?

Added unit tests in RNSentryStartTest.kt covering enabled/disabled/default for enableNdkAppHangTracking and set/default for ndkAppHangTimeoutIntervalMillis.

📝 Checklist

  • I added tests to verify changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed feat(android): Add NDK app hang tracking options #6548
  • I updated the wizard if needed.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

  • Docs update in sentry-docs to document the new options.

🤖 Generated with Claude Code

antonis and others added 2 commits July 31, 2026 10:37
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]>
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • feat(android): Add NDK app hang tracking options by antonis in #6548
  • fix(expo): resolve plugin config when registered as bare '@sentry/react-native' by antonis in #6543
  • fix(ios): make the RNSentry SPEC CHECKSUM in Podfile.lock machine-independent by alwx in #6534
  • chore(deps): update Android SDK to v8.51.0 by github-actions in #6539
  • chore(deps): update Sentry Android Gradle Plugin to v6.17.0 by github-actions in #6544
  • feat(core): Extend TurboModule instrumentation to legacy NativeModules by alwx in #6504
  • feat(ios): Introduce enableMetricKit option by alwx in #6540

🤖 This preview updates automatically when you update the PR.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 26f98fd

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Jul 31, 2026
@antonis
antonis marked this pull request as ready for review July 31, 2026 08:48
@sentry

sentry Bot commented Jul 31, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.21.0 (101) Release

⚙️ sentry-react-native Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3868.96 ms 1234.26 ms -2634.70 ms
Size 5.08 MiB 6.68 MiB 1.60 MiB

Baseline results on branch: main

Startup times

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

@github-actions

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3840.11 ms 1219.10 ms -2621.00 ms
Size 5.08 MiB 6.68 MiB 1.60 MiB

Baseline results on branch: main

Startup times

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

@github-actions

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 429.08 ms 465.26 ms 36.17 ms
Size 49.74 MiB 55.44 MiB 5.70 MiB

Baseline results on branch: main

Startup times

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 antonis removed the ready-to-merge Triggers the full CI test suite label Jul 31, 2026
Comment thread CHANGELOG.md Outdated
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.

Expose Android NDK app hang tracking options (enableNdkAppHangTracking, ndkAppHangTimeoutIntervalMillis)

1 participant