Skip to content

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

Merged
antonis merged 7 commits into
mainfrom
feat/android-ndk-app-hang-tracking
Aug 21, 2026
Merged

feat(android): Add NDK app hang tracking options#6548
antonis merged 7 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
  • chore(deps): bump the codeql-action group with 3 updates by dependabot in #6589
  • chore(deps): bump getsentry/craft from 2.30.0 to 2.30.1 by dependabot in #6591
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.30.0 to 2.30.1 by dependabot in #6590
  • chore(deps): update Sentry Android Gradle Plugin to v6.19.0 by github-actions in #6588
  • chore(deps): update Android SDK to v8.53.0 by github-actions in #6586
  • test(e2e): De-flake TurboModule span-attribute count assertion by antonis in #6596
  • chore(e2e): Bump Android binary size diff limit to 5.8 MiB by antonis in #6595
  • docs: update CONTRIBUTING paths for the monorepo layout by melbinjp in #6594

🤖 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 dbcdb66

@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.23.0 (103) 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 3826.87 ms 1219.67 ms -2607.20 ms
Size 5.08 MiB 6.72 MiB 1.64 MiB

Baseline results on branch: main

Startup times

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

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3827.88 ms 1217.61 ms -2610.27 ms
Size 5.08 MiB 6.72 MiB 1.64 MiB

Baseline results on branch: main

Startup times

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

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 435.28 ms 438.73 ms 3.46 ms
Size 49.74 MiB 55.45 MiB 5.70 MiB

Baseline results on branch: main

Startup times

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

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

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 509.19 ms 531.68 ms 22.49 ms
Size 49.74 MiB 55.45 MiB 5.70 MiB

Baseline results on branch: main

Startup times

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

@antonis
antonis merged commit 2bf340a into main Aug 21, 2026
89 checks passed
@antonis
antonis deleted the feat/android-ndk-app-hang-tracking branch August 21, 2026 08:43
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>
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