Skip to content

Conversation

@alwx
Copy link
Contributor

@alwx alwx commented Jan 8, 2026

Fixes #5516

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

💡 Motivation and Context

💚 How did you test it?

📝 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.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

@alwx alwx self-assigned this Jan 8, 2026
@alwx alwx changed the title WIP: Experimental: Android UI profiling Experimental: Android UI profiling Jan 14, 2026
@alwx alwx marked this pull request as ready for review January 14, 2026 10:54
@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

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).


  • Experimental: Android UI profiling by alwx in #5518
  • fix(ios): Fix duplicate JS error reporting on iOS with New Architecture by antonis in #5532
  • chore(deps): update Bundler Plugins to v4.6.2 by github-actions in #5536
  • chore(deps): update JavaScript SDK to v10.34.0 by github-actions in #5535
  • chore(deps): bump undici from 6.21.3 to 6.23.0 by dependabot in #5533
  • chore(deps): update Cocoa SDK to v8.58.0 by antonis in #5524
  • chore(deps): update Maestro to v2.1.0 by github-actions in #5521
  • chore(deps): update JavaScript SDK to v10.33.0 by github-actions in #5522
  • Fix: Update changelog-preview workflow reference by lucas-zimerman in #5527
  • ci(release): Switch from action-prepare-release to Craft by BYK in #5519
  • chore(deps): update Wizard to v6.11.0 by github-actions in #5520
  • fix(appstart): Skip span ID check when standalone mode is enabled by antonis in #5493
  • chore(deps): update JavaScript SDK to v10.32.1 by github-actions in #5496
  • chore(deps): bump aws-sdk-s3 from 1.169.0 to 1.208.0 in /samples/react-native by dependabot in #5498
  • chore(deps): bump github/codeql-action from 4.31.8 to 4.31.9 by dependabot in #5497
  • chore(deps): bump aws-sdk-s3 from 1.203.0 to 1.208.0 in /performance-tests by dependabot in #5491
  • chore(deps): bump aws-sdk-s3 from 1.169.0 to 1.208.0 in /samples/react-native-macos by dependabot in #5490
  • chore(deps): update JavaScript SDK to v10.32.0 by github-actions in #5487
  • Fix for missing replay_id from metrics by alwx in #5483
  • chore(deps): update Wizard to v6.10.0 by github-actions in #5474
  • Bump e2e tests to XCode 26 by alwx in #5467
  • chore(deps): update JavaScript SDK to v10.31.0 by github-actions in #5480

🤖 This preview updates automatically when you update the PR.

Comment on lines +517 to +518
final String lifecycle = androidProfilingOptions.getString("lifecycle");
if ("manual".equalsIgnoreCase(lifecycle)) {

This comment was marked as outdated.

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Thank you for moving this forward @alwx 🙇
The code changes look good. I would suggest adding an Android UI profiling config to the sample app so that it is easier to test.
We could also add a feature changelog entry (e.g. similar to this) with a config example.

@lucas-zimerman
Copy link
Collaborator

Android UI Profiling Options tests are failing

Copy link
Collaborator

@lucas-zimerman lucas-zimerman left a comment

Choose a reason for hiding this comment

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

The PR is looking good!
Once a changelog is added and the tests are fixed we should be good for merge.

@alwx alwx added the ready-to-merge Triggers the full CI test suite label Jan 15, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 440.49 ms 464.59 ms 24.10 ms
Size 43.75 MiB 48.09 MiB 4.34 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
1c38acd+dirty 398.09 ms 409.18 ms 11.09 ms
b7aa1aa+dirty 324.73 ms 327.76 ms 3.03 ms
785ffb1 471.92 ms 460.96 ms -10.96 ms
fdbea8b+dirty 494.72 ms 529.06 ms 34.34 ms
d1bfbde+dirty 478.88 ms 505.52 ms 26.64 ms
ee69ed5+dirty 409.44 ms 441.30 ms 31.86 ms
0d6e618+dirty 414.00 ms 416.90 ms 2.90 ms
f8d19f8+dirty 422.98 ms 421.98 ms -1.00 ms
8e653ac+dirty 360.28 ms 372.04 ms 11.76 ms
170d5ea+dirty 407.92 ms 422.49 ms 14.57 ms

App size

Revision Plain With Sentry Diff
1c38acd+dirty 43.75 MiB 48.08 MiB 4.33 MiB
b7aa1aa+dirty 17.75 MiB 19.75 MiB 2.00 MiB
785ffb1 17.75 MiB 20.15 MiB 2.41 MiB
fdbea8b+dirty 43.75 MiB 48.05 MiB 4.29 MiB
d1bfbde+dirty 43.75 MiB 47.99 MiB 4.24 MiB
ee69ed5+dirty 43.75 MiB 48.04 MiB 4.29 MiB
0d6e618+dirty 43.75 MiB 47.99 MiB 4.24 MiB
f8d19f8+dirty 43.75 MiB 48.08 MiB 4.33 MiB
8e653ac+dirty 17.75 MiB 19.75 MiB 2.00 MiB
170d5ea+dirty 17.75 MiB 19.70 MiB 1.95 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 372.23 ms 390.98 ms 18.75 ms
Size 43.94 MiB 48.92 MiB 4.98 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
1c38acd+dirty 411.84 ms 470.18 ms 58.34 ms
b7aa1aa+dirty 281.02 ms 317.53 ms 36.51 ms
fdbea8b+dirty 551.94 ms 577.02 ms 25.08 ms
a02e30b+dirty 346.13 ms 381.76 ms 35.62 ms
c7f264b+dirty 356.98 ms 407.46 ms 50.48 ms
d1bfbde+dirty 438.90 ms 494.82 ms 55.92 ms
ee69ed5+dirty 411.19 ms 447.04 ms 35.85 ms
0d6e618+dirty 369.02 ms 387.69 ms 18.67 ms
46bd012+dirty 333.76 ms 359.24 ms 25.48 ms
f8d19f8+dirty 374.17 ms 383.40 ms 9.23 ms

App size

Revision Plain With Sentry Diff
1c38acd+dirty 43.94 MiB 48.91 MiB 4.97 MiB
b7aa1aa+dirty 7.15 MiB 8.46 MiB 1.31 MiB
fdbea8b+dirty 43.94 MiB 48.87 MiB 4.93 MiB
a02e30b+dirty 7.15 MiB 8.42 MiB 1.27 MiB
c7f264b+dirty 7.15 MiB 8.41 MiB 1.26 MiB
d1bfbde+dirty 43.94 MiB 48.82 MiB 4.88 MiB
ee69ed5+dirty 43.94 MiB 48.87 MiB 4.93 MiB
0d6e618+dirty 43.94 MiB 48.82 MiB 4.88 MiB
46bd012+dirty 7.15 MiB 8.42 MiB 1.27 MiB
f8d19f8+dirty 43.94 MiB 48.91 MiB 4.97 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1205.57 ms 1213.62 ms 8.05 ms
Size 3.38 MiB 4.60 MiB 1.22 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
46e3d54+dirty 1213.17 ms 1216.33 ms 3.17 ms
46bd012+dirty 1231.78 ms 1212.30 ms -19.47 ms
eb07ba3+dirty 1214.49 ms 1221.59 ms 7.10 ms
0b64753+dirty 1225.77 ms 1232.98 ms 7.21 ms
6a70a7e+dirty 1231.40 ms 1239.49 ms 8.09 ms
3401245+dirty 1216.70 ms 1241.44 ms 24.74 ms
2104bb9+dirty 1221.63 ms 1214.73 ms -6.91 ms
3e0a5f9+dirty 1233.65 ms 1239.10 ms 5.45 ms
3bd3f0d+dirty 1230.18 ms 1243.41 ms 13.22 ms
955f2eb+dirty 1225.78 ms 1239.27 ms 13.49 ms

App size

Revision Plain With Sentry Diff
46e3d54+dirty 3.41 MiB 4.58 MiB 1.17 MiB
46bd012+dirty 3.19 MiB 4.38 MiB 1.19 MiB
eb07ba3+dirty 3.19 MiB 4.38 MiB 1.19 MiB
0b64753+dirty 3.19 MiB 4.55 MiB 1.36 MiB
6a70a7e+dirty 3.19 MiB 4.54 MiB 1.36 MiB
3401245+dirty 3.41 MiB 4.58 MiB 1.17 MiB
2104bb9+dirty 3.19 MiB 4.57 MiB 1.38 MiB
3e0a5f9+dirty 3.19 MiB 4.38 MiB 1.19 MiB
3bd3f0d+dirty 3.19 MiB 4.55 MiB 1.37 MiB
955f2eb+dirty 3.19 MiB 4.55 MiB 1.36 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1219.89 ms 1221.17 ms 1.27 ms
Size 3.38 MiB 4.60 MiB 1.22 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
46e3d54+dirty 1216.40 ms 1210.47 ms -5.93 ms
46bd012+dirty 1220.49 ms 1226.89 ms 6.40 ms
eb07ba3+dirty 1222.46 ms 1220.37 ms -2.08 ms
0b64753+dirty 1232.49 ms 1226.96 ms -5.53 ms
6a70a7e+dirty 1225.82 ms 1230.79 ms 4.98 ms
3401245+dirty 1222.60 ms 1223.06 ms 0.46 ms
2104bb9+dirty 1222.94 ms 1221.16 ms -1.77 ms
3e0a5f9+dirty 1226.94 ms 1230.02 ms 3.08 ms
3bd3f0d+dirty 1231.51 ms 1229.10 ms -2.41 ms
955f2eb+dirty 1235.06 ms 1253.88 ms 18.81 ms

App size

Revision Plain With Sentry Diff
46e3d54+dirty 3.41 MiB 4.58 MiB 1.17 MiB
46bd012+dirty 2.63 MiB 3.81 MiB 1.18 MiB
eb07ba3+dirty 2.63 MiB 3.81 MiB 1.18 MiB
0b64753+dirty 2.63 MiB 3.98 MiB 1.35 MiB
6a70a7e+dirty 2.63 MiB 3.98 MiB 1.34 MiB
3401245+dirty 3.41 MiB 4.58 MiB 1.17 MiB
2104bb9+dirty 2.63 MiB 4.00 MiB 1.37 MiB
3e0a5f9+dirty 2.63 MiB 3.81 MiB 1.18 MiB
3bd3f0d+dirty 2.63 MiB 3.99 MiB 1.35 MiB
955f2eb+dirty 2.63 MiB 3.98 MiB 1.35 MiB

'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]
? (this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] as ReturnType<typeof mobileReplayIntegration>).options
: undefined,
androidProfilingOptions: this._options._experiments?.androidProfilingOptions,
Copy link

Choose a reason for hiding this comment

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

Bug: androidProfilingOptions are read from _experiments before they are moved there, causing them to be undefined when passed to the native SDK.
Severity: HIGH

Suggested Fix

In client.ts, modify the code to read androidProfilingOptions directly from the top-level options object. Change the access from this._options._experiments?.androidProfilingOptions to this._options.androidProfilingOptions.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/core/src/js/client.ts#L227

Potential issue: In `client.ts`, the `androidProfilingOptions` are incorrectly read from
`this._options._experiments?.androidProfilingOptions`. At this stage of the
initialization process, these options are still located at the top level of
`this._options` and have not yet been moved into the `_experiments` object. This move
happens later in `wrapper.ts`. As a result, `undefined` is passed to the native SDK,
which completely disables the Android UI profiling feature even when it is correctly
configured by the user.

Did we get this right? 👍 / 👎 to inform future reviews.


### Features

- Experimental support of UI profiling on Android ([#5518](https://github.com/getsentry/sentry-react-native/pull/5518))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: @alwx Since the feature is experimental and we don't have documentation published yet wdyt of adding a sample like the following and a link to the doc?

Suggested change
- Experimental support of UI profiling on Android ([#5518](https://github.com/getsentry/sentry-react-native/pull/5518))
- Experimental support of UI profiling on Android ([#5518](https://github.com/getsentry/sentry-react-native/pull/5518))
```typescript
Sentry.init({
// other options...
_experiments: {
androidProfilingOptions: {
profileSessionSampleRate: 1.0,
lifecycle: 'trace',
startOnAppStart: true,
},
}
});
```
To learn more visit [the documentation](https://docs.sentry.io/platforms/android/profiling/)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@antonis the sample is coming, yes!

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for your work on this 🙇

@alwx alwx merged commit 7b02433 into main Jan 15, 2026
110 of 114 checks passed
@alwx alwx deleted the alwx/imporvement/android-ui-profiling branch January 15, 2026 14:57
alwx added a commit to getsentry/sentry-docs that referenced this pull request Jan 15, 2026
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->

## DESCRIBE YOUR PR

This PR is to support changes in UI profiling for React Native done
here: getsentry/sentry-react-native#5518

## IS YOUR CHANGE URGENT?  

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
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.

Android UI profiling

4 participants