Skip to content

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

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

feat(android): Add NDK app hang tracking options#6548
antonis wants to merge 5 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 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@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(core): Attach debug_meta to Hermes JS error events via Debug ID lookup by antonis in #6545
  • ci: Replace secrets: inherit with explicit SENTRY_AUTH_TOKEN pass by oioki in #6562
  • chore(deps): update Wizard to v7.0.0 by github-actions in #6558
  • chore(deps): bump the codeql-action group with 3 updates by dependabot in #6553
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.14 to 2.28.0 by dependabot in #6554
  • chore(deps): bump fast-uri from 3.1.4 to 3.1.5 by dependabot in #6560
  • chore(deps): bump getsentry/craft from 2.26.14 to 2.28.0 by dependabot in #6556
  • chore(deps): bump ip-address from 10.2.0 to 10.4.0 by dependabot in #6557
  • chore(deps): bump undici from 6.27.0 to 6.28.0 by dependabot in #6559
  • chore(deps): bump actions/setup-java from 5.6.0 to 5.7.0 by dependabot in #6555
  • chore(deps): bump brace-expansion from 1.1.16 to 1.1.18 by dependabot in #6552
  • 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
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against fc07b5f

@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

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3838.72 ms 1222.15 ms -2616.58 ms
Size 5.08 MiB 6.68 MiB 1.60 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
1059cf6+dirty 3840.78 ms 1215.18 ms -2625.60 ms
0a9e622+dirty 3835.87 ms 1221.07 ms -2614.80 ms
7d6fd3a+dirty 1223.29 ms 1229.57 ms 6.28 ms
5ca03f9+dirty 3844.55 ms 1218.36 ms -2626.19 ms
774257e+dirty 3846.90 ms 1215.02 ms -2631.88 ms
40c9884+dirty 3837.72 ms 1226.61 ms -2611.11 ms
4e0b819+dirty 3839.05 ms 1210.75 ms -2628.30 ms
d038a14+dirty 3845.71 ms 1228.11 ms -2617.59 ms
57e0069+dirty 3842.29 ms 1212.12 ms -2630.17 ms
882f8ae+dirty 3840.30 ms 1224.41 ms -2615.88 ms

App size

Revision Plain With Sentry Diff
1059cf6+dirty 5.08 MiB 6.68 MiB 1.60 MiB
0a9e622+dirty 4.98 MiB 6.51 MiB 1.53 MiB
7d6fd3a+dirty 3.38 MiB 4.77 MiB 1.39 MiB
5ca03f9+dirty 4.98 MiB 6.53 MiB 1.55 MiB
774257e+dirty 5.15 MiB 6.70 MiB 1.54 MiB
40c9884+dirty 4.98 MiB 6.51 MiB 1.53 MiB
4e0b819+dirty 4.98 MiB 6.46 MiB 1.49 MiB
d038a14+dirty 5.15 MiB 6.67 MiB 1.51 MiB
57e0069+dirty 4.98 MiB 6.50 MiB 1.52 MiB
882f8ae+dirty 5.15 MiB 6.70 MiB 1.54 MiB

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3853.52 ms 1230.75 ms -2622.77 ms
Size 5.08 MiB 6.68 MiB 1.60 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
3b6e9f9+dirty 3822.77 ms 1208.00 ms -2614.77 ms
1059cf6+dirty 3846.06 ms 1223.06 ms -2623.00 ms
4e0b819+dirty 3828.96 ms 1205.64 ms -2623.32 ms
1e5d96d+dirty 3845.93 ms 1222.51 ms -2623.42 ms
0a9e622+dirty 3825.35 ms 1219.04 ms -2606.31 ms
5ca03f9+dirty 3873.76 ms 1236.26 ms -2637.51 ms
40c9884+dirty 3826.11 ms 1217.04 ms -2609.07 ms
57e0069+dirty 3842.23 ms 1210.00 ms -2632.23 ms
7ac3378+dirty 1202.35 ms 1198.31 ms -4.04 ms
d67e46f+dirty 3846.87 ms 1225.34 ms -2621.53 ms

App size

Revision Plain With Sentry Diff
3b6e9f9+dirty 5.15 MiB 6.68 MiB 1.53 MiB
1059cf6+dirty 5.08 MiB 6.68 MiB 1.60 MiB
4e0b819+dirty 4.98 MiB 6.46 MiB 1.49 MiB
1e5d96d+dirty 4.98 MiB 6.46 MiB 1.49 MiB
0a9e622+dirty 4.98 MiB 6.51 MiB 1.53 MiB
5ca03f9+dirty 4.98 MiB 6.53 MiB 1.55 MiB
40c9884+dirty 4.98 MiB 6.51 MiB 1.53 MiB
57e0069+dirty 4.98 MiB 6.50 MiB 1.52 MiB
7ac3378+dirty 3.38 MiB 4.76 MiB 1.38 MiB
d67e46f+dirty 5.08 MiB 6.68 MiB 1.60 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

@lucas-zimerman lucas-zimerman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@lucas-zimerman lucas-zimerman added the ready-to-merge Triggers the full CI test suite label Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants