Skip to content

Conversation

@romtsn
Copy link
Member

@romtsn romtsn commented Sep 16, 2025

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

  • Introduce new module replay-stubs under the android target. This allows customers to exclude sentry-android-replay if they are not interested in replay and save some bundle size
  • Introduce new step in the update-deps workflow to bump the current sentry version which the stubs are compiled against
  • The stubs are generated as part of yarn build (via ./gradlew jar) and checked into git so the android target can use it
  • In addition, check at runtime if the replay classes are present via reflection and only instantiate replay-related classes if that's the case
  • Please read more details under README.md of the respective module

Here's an example replay after the changes: https://sentry-sdks.sentry.io/explore/replays/f0a8d20f73d54ea4b553901edeb83c50/

💡 Motivation and Context

Closes getsentry/sentry-java#4718
Closes ANDROID-197

💚 How did you test it?

Only manually tested for now, there's no really a good way to automatically test it without setting up gradle testkit which seems like a lot of work for little benefit (considering this is not a default behavior and likely rarely needed).

📝 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

@linear
Copy link

linear bot commented Sep 16, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Sep 16, 2025

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1226.43 ms 1232.14 ms 5.71 ms
Size 2.63 MiB 3.96 MiB 1.33 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
785ffb1+dirty 1237.63 ms 1240.50 ms 2.87 ms
95aaf8a+dirty 1234.78 ms 1241.94 ms 7.16 ms
c08359e+dirty 1235.25 ms 1233.96 ms -1.29 ms
c1573b3+dirty 1203.33 ms 1202.47 ms -0.86 ms
7be1f99+dirty 1226.69 ms 1217.76 ms -8.93 ms
ba75c7c+dirty 1235.86 ms 1226.45 ms -9.41 ms
1853710+dirty 1224.35 ms 1230.18 ms 5.84 ms
534ba8c+dirty 1230.22 ms 1231.18 ms 0.96 ms
af9331b+dirty 1233.61 ms 1230.50 ms -3.11 ms
c9e95bd+dirty 1240.19 ms 1246.33 ms 6.14 ms

App size

Revision Plain With Sentry Diff
785ffb1+dirty 2.63 MiB 3.81 MiB 1.18 MiB
95aaf8a+dirty 2.63 MiB 3.87 MiB 1.24 MiB
c08359e+dirty 2.63 MiB 3.81 MiB 1.18 MiB
c1573b3+dirty 2.63 MiB 3.81 MiB 1.18 MiB
7be1f99+dirty 2.63 MiB 3.81 MiB 1.18 MiB
ba75c7c+dirty 2.63 MiB 3.81 MiB 1.18 MiB
1853710+dirty 2.63 MiB 3.91 MiB 1.28 MiB
534ba8c+dirty 2.63 MiB 3.81 MiB 1.18 MiB
af9331b+dirty 2.63 MiB 3.91 MiB 1.28 MiB
c9e95bd+dirty 2.63 MiB 3.87 MiB 1.24 MiB

Previous results on branch: rz/fix/session-replay-exclusion

Startup times

Revision Plain With Sentry Diff
8089584+dirty 1234.94 ms 1241.04 ms 6.10 ms

App size

Revision Plain With Sentry Diff
8089584+dirty 2.63 MiB 3.96 MiB 1.33 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Sep 16, 2025

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1248.88 ms 1250.57 ms 1.70 ms
Size 3.19 MiB 4.53 MiB 1.34 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
785ffb1+dirty 1213.71 ms 1213.37 ms -0.35 ms
95aaf8a+dirty 1206.83 ms 1213.65 ms 6.81 ms
c08359e+dirty 1200.59 ms 1211.81 ms 11.22 ms
c1573b3+dirty 1245.69 ms 1245.48 ms -0.21 ms
7be1f99+dirty 1222.43 ms 1217.15 ms -5.28 ms
ba75c7c+dirty 1236.14 ms 1240.69 ms 4.55 ms
1853710+dirty 1213.67 ms 1226.35 ms 12.67 ms
534ba8c+dirty 1225.00 ms 1237.43 ms 12.43 ms
af9331b+dirty 1230.08 ms 1233.24 ms 3.16 ms
c9e95bd+dirty 1205.83 ms 1207.38 ms 1.55 ms

App size

Revision Plain With Sentry Diff
785ffb1+dirty 3.19 MiB 4.38 MiB 1.19 MiB
95aaf8a+dirty 3.19 MiB 4.44 MiB 1.25 MiB
c08359e+dirty 3.19 MiB 4.38 MiB 1.19 MiB
c1573b3+dirty 3.19 MiB 4.38 MiB 1.19 MiB
7be1f99+dirty 3.19 MiB 4.38 MiB 1.19 MiB
ba75c7c+dirty 3.19 MiB 4.38 MiB 1.19 MiB
1853710+dirty 3.19 MiB 4.48 MiB 1.29 MiB
534ba8c+dirty 3.19 MiB 4.38 MiB 1.19 MiB
af9331b+dirty 3.19 MiB 4.48 MiB 1.29 MiB
c9e95bd+dirty 3.19 MiB 4.44 MiB 1.25 MiB

Previous results on branch: rz/fix/session-replay-exclusion

Startup times

Revision Plain With Sentry Diff
8089584+dirty 1230.98 ms 1231.10 ms 0.12 ms

App size

Revision Plain With Sentry Diff
8089584+dirty 3.19 MiB 4.53 MiB 1.34 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Sep 16, 2025

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 457.19 ms 479.64 ms 22.45 ms
Size 17.75 MiB 19.68 MiB 1.94 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
eb07ba3 470.04 ms 473.35 ms 3.31 ms
ba75c7c 367.72 ms 369.16 ms 1.44 ms
3e0a5f9 401.72 ms 394.98 ms -6.74 ms
1853710 555.47 ms 556.59 ms 1.12 ms
46bd012 387.09 ms 404.47 ms 17.38 ms
c4e097a 338.06 ms 439.36 ms 101.30 ms
e2fa43d 451.68 ms 462.42 ms 10.74 ms
64cd15c 439.02 ms 427.63 ms -11.39 ms
d916aa3 425.37 ms 427.02 ms 1.65 ms
a0b15d6 423.06 ms 437.77 ms 14.71 ms

App size

Revision Plain With Sentry Diff
eb07ba3 17.75 MiB 20.15 MiB 2.41 MiB
ba75c7c 17.75 MiB 20.15 MiB 2.41 MiB
3e0a5f9 17.75 MiB 20.15 MiB 2.41 MiB
1853710 17.75 MiB 19.68 MiB 1.94 MiB
46bd012 17.75 MiB 20.15 MiB 2.41 MiB
c4e097a 17.75 MiB 19.68 MiB 1.94 MiB
e2fa43d 17.75 MiB 20.15 MiB 2.41 MiB
64cd15c 17.75 MiB 20.15 MiB 2.41 MiB
d916aa3 17.75 MiB 20.15 MiB 2.41 MiB
a0b15d6 17.75 MiB 20.15 MiB 2.41 MiB

Previous results on branch: rz/fix/session-replay-exclusion

Startup times

Revision Plain With Sentry Diff
8089584+dirty 459.48 ms 477.07 ms 17.59 ms

App size

Revision Plain With Sentry Diff
8089584+dirty 17.75 MiB 19.68 MiB 1.94 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Sep 16, 2025

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 350.00 ms 404.66 ms 54.66 ms
Size 7.15 MiB 8.41 MiB 1.26 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
7be1f99+dirty 369.02 ms 399.60 ms 30.58 ms
3e0a5f9+dirty 379.92 ms 450.96 ms 71.04 ms
e2fa43d+dirty 326.56 ms 372.88 ms 46.32 ms
8a4ce6f+dirty 401.11 ms 381.92 ms -19.19 ms
000da7a+dirty 347.89 ms 381.98 ms 34.09 ms
785ffb1+dirty 380.65 ms 451.83 ms 71.18 ms
c9e95bd+dirty 339.32 ms 401.24 ms 61.92 ms
8ece263+dirty 369.44 ms 414.65 ms 45.21 ms
bc9680d+dirty 346.77 ms 463.48 ms 116.71 ms
b3b5b0d+dirty 361.42 ms 403.90 ms 42.48 ms

App size

Revision Plain With Sentry Diff
7be1f99+dirty 7.15 MiB 8.42 MiB 1.27 MiB
3e0a5f9+dirty 7.15 MiB 8.42 MiB 1.27 MiB
e2fa43d+dirty 7.15 MiB 8.42 MiB 1.27 MiB
8a4ce6f+dirty 7.15 MiB 8.41 MiB 1.26 MiB
000da7a+dirty 7.15 MiB 8.41 MiB 1.26 MiB
785ffb1+dirty 7.15 MiB 8.42 MiB 1.27 MiB
c9e95bd+dirty 7.15 MiB 8.41 MiB 1.26 MiB
8ece263+dirty 7.15 MiB 8.41 MiB 1.26 MiB
bc9680d+dirty 7.15 MiB 8.42 MiB 1.27 MiB
b3b5b0d+dirty 7.15 MiB 8.41 MiB 1.26 MiB

Previous results on branch: rz/fix/session-replay-exclusion

Startup times

Revision Plain With Sentry Diff
8089584+dirty 402.45 ms 471.76 ms 69.31 ms

App size

Revision Plain With Sentry Diff
8089584+dirty 7.15 MiB 8.41 MiB 1.26 MiB


### Fixes

- Session Replay: Allow excluding `sentry-android-replay` from android targets ([#5174](https://github.com/getsentry/sentry-react-native/pull/5174))
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be nice to include a simple mention on how to remove it with a sample diff

Copy link
Collaborator

Choose a reason for hiding this comment

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

Example of what we did for Web Replay: https://github.com/getsentry/sentry-react-native/blob/cf745081e2928fd7b1459e38989d54d8ef0815b9/CHANGELOG.md#features-25

And with that, it's optional, but we could also include an estimation on how much app size is reduced when users opt out for mobile replay.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added both 👍

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 🚀

@antonis antonis merged commit 5c16cdc into main Sep 16, 2025
73 checks passed
@antonis antonis deleted the rz/fix/session-replay-exclusion branch September 16, 2025 13:30
antonis added a commit to getsentry/sentry-docs that referenced this pull request Sep 17, 2025
…from android targets (#14963)

<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->

## DESCRIBE YOUR PR
*Tell us what you're changing and why. If your PR **resolves an issue**,
please link it so it closes automatically.*

Adds instructions for excluding the sentry-android-replay module from
android targets

## 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 -->
- [ ] None: Not urgent, can wait up to 1 week+

The related PR
getsentry/sentry-react-native#5174
has been released in
https://github.com/getsentry/sentry-react-native/releases/tag/7.1.0

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!

## PRE-MERGE CHECKLIST

*Make sure you've checked the following before merging your changes:*

- [ ] 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)

## LEGAL BOILERPLATE

<!-- Sentry employees and contractors can delete or ignore this section.
-->

Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.

## EXTRA RESOURCES

- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
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.

exclude session-replay from sdk, if not using session replay

4 participants