Skip to content

feat(expo): Add RNSentrySDK APIs support to @sentry/react-native/expo plugin #4633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: capture-app-start-errors
Choose a base branch
from

Conversation

antonis
Copy link
Collaborator

@antonis antonis commented Mar 7, 2025

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Adds RNSentrySDK APIs support to @sentry/react-native/expo plugin by importing sentry and adding injecting RNSentrySDK.init/start in the Android MainApplication (Kotlin or Java) or AppDelegate (Objective-C or Swift).

This feature is opt-out to enable it set useNativeInit to true in your @sentry/react-native/expo plugin configuration.

"plugins": [
  [
    "@sentry/react-native/expo",
    {
      "useNativeInit": true
    }
  ],

💡 Motivation and Context

Fixes #4625

💚 How did you test it?

CI, Manual

📝 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

Copy link
Contributor

github-actions bot commented Mar 7, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 5447be9

Copy link
Contributor

github-actions bot commented Mar 7, 2025

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1215.30 ms 1217.51 ms 2.21 ms
Size 2.63 MiB 3.75 MiB 1.12 MiB

Baseline results on branch: capture-app-start-errors

Startup times

Revision Plain With Sentry Diff
18a5066+dirty 1218.00 ms 1212.27 ms -5.73 ms
b6d933c+dirty 1217.71 ms 1220.58 ms 2.87 ms
1a89392+dirty 1220.12 ms 1216.69 ms -3.43 ms
c8578fb+dirty 1218.55 ms 1217.23 ms -1.32 ms
208f4af+dirty 1209.44 ms 1217.13 ms 7.70 ms
454f971+dirty 1220.55 ms 1225.82 ms 5.27 ms
8d0daf6+dirty 1230.90 ms 1233.16 ms 2.27 ms
b75148e+dirty 1221.53 ms 1220.85 ms -0.68 ms
5625ce7+dirty 1226.98 ms 1217.77 ms -9.21 ms
555070f+dirty 1213.59 ms 1217.79 ms 4.20 ms

App size

Revision Plain With Sentry Diff
18a5066+dirty 2.63 MiB 3.70 MiB 1.06 MiB
b6d933c+dirty 2.63 MiB 3.70 MiB 1.06 MiB
1a89392+dirty 2.63 MiB 3.70 MiB 1.06 MiB
c8578fb+dirty 2.63 MiB 3.74 MiB 1.11 MiB
208f4af+dirty 2.63 MiB 3.69 MiB 1.05 MiB
454f971+dirty 2.63 MiB 3.74 MiB 1.11 MiB
8d0daf6+dirty 2.63 MiB 3.74 MiB 1.11 MiB
b75148e+dirty 2.63 MiB 3.69 MiB 1.06 MiB
5625ce7+dirty 2.63 MiB 3.70 MiB 1.06 MiB
555070f+dirty 2.63 MiB 3.69 MiB 1.05 MiB

Previous results on branch: antonis/4625-expo-useNativeInit

Startup times

Revision Plain With Sentry Diff
0d27e17+dirty 1244.69 ms 1239.24 ms -5.45 ms
1c7705c+dirty 1225.00 ms 1234.94 ms 9.94 ms
86785b7+dirty 1229.12 ms 1239.47 ms 10.35 ms
18c4361+dirty 1216.24 ms 1216.10 ms -0.14 ms

App size

Revision Plain With Sentry Diff
0d27e17+dirty 2.63 MiB 3.75 MiB 1.12 MiB
1c7705c+dirty 2.63 MiB 3.75 MiB 1.12 MiB
86785b7+dirty 2.63 MiB 3.75 MiB 1.12 MiB
18c4361+dirty 2.63 MiB 3.75 MiB 1.12 MiB

Copy link
Contributor

github-actions bot commented Mar 7, 2025

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1217.40 ms 1228.00 ms 10.60 ms
Size 3.19 MiB 4.32 MiB 1.13 MiB

Baseline results on branch: capture-app-start-errors

Startup times

Revision Plain With Sentry Diff
18a5066+dirty 1244.20 ms 1251.54 ms 7.34 ms
b6d933c+dirty 1228.02 ms 1235.32 ms 7.30 ms
1a89392+dirty 1229.00 ms 1234.78 ms 5.78 ms
c8578fb+dirty 1225.49 ms 1224.29 ms -1.20 ms
208f4af+dirty 1213.08 ms 1223.82 ms 10.73 ms
454f971+dirty 1233.51 ms 1239.18 ms 5.67 ms
8d0daf6+dirty 1227.80 ms 1236.83 ms 9.03 ms
b75148e+dirty 1202.72 ms 1212.04 ms 9.32 ms
5625ce7+dirty 1219.73 ms 1223.80 ms 4.07 ms
555070f+dirty 1223.61 ms 1227.57 ms 3.96 ms

App size

Revision Plain With Sentry Diff
18a5066+dirty 3.19 MiB 4.26 MiB 1.08 MiB
b6d933c+dirty 3.19 MiB 4.26 MiB 1.08 MiB
1a89392+dirty 3.19 MiB 4.26 MiB 1.08 MiB
c8578fb+dirty 3.19 MiB 4.30 MiB 1.12 MiB
208f4af+dirty 3.19 MiB 4.25 MiB 1.06 MiB
454f971+dirty 3.19 MiB 4.31 MiB 1.12 MiB
8d0daf6+dirty 3.19 MiB 4.30 MiB 1.12 MiB
b75148e+dirty 3.19 MiB 4.25 MiB 1.07 MiB
5625ce7+dirty 3.19 MiB 4.26 MiB 1.08 MiB
555070f+dirty 3.19 MiB 4.25 MiB 1.06 MiB

Previous results on branch: antonis/4625-expo-useNativeInit

Startup times

Revision Plain With Sentry Diff
0d27e17+dirty 1221.45 ms 1231.18 ms 9.73 ms
1c7705c+dirty 1227.79 ms 1232.04 ms 4.25 ms
86785b7+dirty 1220.15 ms 1222.75 ms 2.60 ms
18c4361+dirty 1226.52 ms 1221.74 ms -4.78 ms

App size

Revision Plain With Sentry Diff
0d27e17+dirty 3.19 MiB 4.32 MiB 1.13 MiB
1c7705c+dirty 3.19 MiB 4.32 MiB 1.13 MiB
86785b7+dirty 3.19 MiB 4.32 MiB 1.13 MiB
18c4361+dirty 3.19 MiB 4.32 MiB 1.13 MiB

Copy link
Contributor

github-actions bot commented Mar 7, 2025

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 419.06 ms 424.75 ms 5.69 ms
Size 17.75 MiB 20.12 MiB 2.37 MiB

Baseline results on branch: capture-app-start-errors

Startup times

Revision Plain With Sentry Diff
b75148e 440.04 ms 421.36 ms -18.68 ms
555070f 438.67 ms 428.30 ms -10.37 ms
1a89392 412.59 ms 424.69 ms 12.10 ms
b6d933c 442.52 ms 461.82 ms 19.30 ms
8d0daf6 422.36 ms 449.40 ms 27.04 ms
208f4af 439.23 ms 427.31 ms -11.92 ms
5625ce7 476.74 ms 488.24 ms 11.50 ms
c8578fb 397.17 ms 415.72 ms 18.55 ms
454f971 436.27 ms 478.76 ms 42.48 ms
18a5066 427.89 ms 436.47 ms 8.57 ms

App size

Revision Plain With Sentry Diff
b75148e 17.75 MiB 20.11 MiB 2.37 MiB
555070f 17.75 MiB 20.11 MiB 2.37 MiB
1a89392 17.75 MiB 20.11 MiB 2.37 MiB
b6d933c 17.75 MiB 20.11 MiB 2.37 MiB
8d0daf6 17.75 MiB 20.11 MiB 2.36 MiB
208f4af 17.75 MiB 20.11 MiB 2.37 MiB
5625ce7 17.75 MiB 20.11 MiB 2.37 MiB
c8578fb 17.75 MiB 20.11 MiB 2.36 MiB
454f971 17.75 MiB 20.11 MiB 2.37 MiB
18a5066 17.75 MiB 20.11 MiB 2.37 MiB

Previous results on branch: antonis/4625-expo-useNativeInit

Startup times

Revision Plain With Sentry Diff
1c7705c 434.96 ms 433.74 ms -1.22 ms
0d27e17 397.58 ms 393.65 ms -3.93 ms
18c4361 457.04 ms 460.22 ms 3.18 ms
86785b7 461.64 ms 500.45 ms 38.81 ms

App size

Revision Plain With Sentry Diff
1c7705c 17.75 MiB 20.12 MiB 2.37 MiB
0d27e17 17.75 MiB 20.12 MiB 2.37 MiB
18c4361 17.75 MiB 20.12 MiB 2.37 MiB
86785b7 17.75 MiB 20.12 MiB 2.37 MiB

Copy link
Contributor

github-actions bot commented Mar 7, 2025

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 386.07 ms 379.67 ms -6.40 ms
Size 7.15 MiB 8.39 MiB 1.24 MiB

Baseline results on branch: capture-app-start-errors

Startup times

Revision Plain With Sentry Diff
b75148e+dirty 428.91 ms 461.26 ms 32.35 ms
18a5066+dirty 370.06 ms 414.10 ms 44.04 ms
5625ce7+dirty 358.15 ms 416.65 ms 58.50 ms
454f971+dirty 439.04 ms 423.88 ms -15.16 ms
c8578fb+dirty 374.17 ms 362.06 ms -12.11 ms
208f4af+dirty 346.93 ms 402.77 ms 55.84 ms
8d0daf6+dirty 393.58 ms 394.84 ms 1.26 ms
555070f+dirty 388.25 ms 424.44 ms 36.19 ms
b6d933c+dirty 398.43 ms 456.62 ms 58.19 ms
1a89392+dirty 425.56 ms 530.65 ms 105.09 ms

App size

Revision Plain With Sentry Diff
b75148e+dirty 7.15 MiB 8.38 MiB 1.23 MiB
18a5066+dirty 7.15 MiB 8.38 MiB 1.23 MiB
5625ce7+dirty 7.15 MiB 8.38 MiB 1.23 MiB
454f971+dirty 7.15 MiB 8.38 MiB 1.23 MiB
c8578fb+dirty 7.15 MiB 8.38 MiB 1.23 MiB
208f4af+dirty 7.15 MiB 8.38 MiB 1.23 MiB
8d0daf6+dirty 7.15 MiB 8.38 MiB 1.23 MiB
555070f+dirty 7.15 MiB 8.38 MiB 1.23 MiB
b6d933c+dirty 7.15 MiB 8.38 MiB 1.23 MiB
1a89392+dirty 7.15 MiB 8.38 MiB 1.23 MiB

Previous results on branch: antonis/4625-expo-useNativeInit

Startup times

Revision Plain With Sentry Diff
18c4361+dirty 403.37 ms 409.86 ms 6.49 ms
1c7705c+dirty 413.96 ms 422.29 ms 8.33 ms
0d27e17+dirty 338.30 ms 350.69 ms 12.39 ms
86785b7+dirty 376.98 ms 384.20 ms 7.23 ms

App size

Revision Plain With Sentry Diff
18c4361+dirty 7.15 MiB 8.39 MiB 1.24 MiB
1c7705c+dirty 7.15 MiB 8.39 MiB 1.24 MiB
0d27e17+dirty 7.15 MiB 8.39 MiB 1.24 MiB
86785b7+dirty 7.15 MiB 8.39 MiB 1.24 MiB

@antonis antonis linked an issue Mar 7, 2025 that may be closed by this pull request
@antonis antonis marked this pull request as ready for review March 7, 2025 16:22
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.

Overall the PR looks good and thank you for the tests!
I still think we could fine tune a bit more the android part and after it we could get ready for merge

antonis and others added 2 commits April 4, 2025 11:01
Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com>
@antonis antonis requested a review from lucas-zimerman April 4, 2025 09:45
@antonis
Copy link
Collaborator Author

antonis commented Apr 4, 2025

Note: The Build & Test / Type Check Typescript 3.8 (pull_request) failure should be fixed when we merge #4673 from main

@antonis antonis requested a review from krystofwoldrich April 15, 2025 10:00
Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>
antonis and others added 3 commits April 15, 2025 13:36
@antonis antonis requested a review from krystofwoldrich April 15, 2025 11:34
@antonis antonis requested a review from krystofwoldrich April 16, 2025 08:34
`$1\n RNSentrySDK.start()`,
);
if (config.modResults.contents === originalContents) {
warnOnce(`Failed to insert 'RNSentrySDK.start()' in '${fileName}.`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT: missing '

Suggested change
warnOnce(`Failed to insert 'RNSentrySDK.start()' in '${fileName}.`);
warnOnce(`Failed to insert 'RNSentrySDK.start()' in '${fileName}'.`);

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.

I have re-checked the PR and overall, I only found a nit on a string. After fixing it and if @krystofwoldrich doesn't find anything else, LGTM!

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.

Add RNSentrySDK APIs support to @sentry/react-native/expo plugin
3 participants