Skip to content
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

Add Sentry SDK #3629

Closed
wants to merge 25 commits into from
Closed

Add Sentry SDK #3629

wants to merge 25 commits into from

Conversation

fluiddot
Copy link
Contributor

@fluiddot fluiddot commented Jun 17, 2021

gutenberg PR: WordPress/gutenberg#32768
WordPress-iOSPR: wordpress-mobile/WordPress-iOS#16700
Automattic-Tracks-iOS PR: Automattic/Automattic-Tracks-iOS#183

This PR adds the Sentry React native SDK and customize the initialization to accomplish the following items:

  1. Use the same options used for initializing the SDK in the main apps.
  2. Only enable the needed Sentry integrations.
  3. Add beforeSend callback to attach the same scope defined in the main apps and prevent sending events as it's determined in the main apps (code reference).

NOTE: The Sentry SDK will be only enabled on iOS.

To test:
Follow the testing instructions from gutenberg PR: WordPress/gutenberg#32768.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered if this change warrants user-facing release notes more info and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jun 17, 2021

Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job!

metro.config.js Outdated
const moduleFolderPnpm = path.join(
process.cwd(),
`./jetpack/node_modules/.pnpm/node_modules/${ name }`
);

// pnpm uses symlinks so, let's find the target
const symlinkTarget = fs.readlinkSync( moduleFolderPnpm );
if ( fs.existsSync( moduleFolderPnpm ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that the dependencies from the package.json file of Gutenberg Mobile were being resolved using the Jetpack path, so I added this condition to prevent it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, is that related to the Sentry work here, or are you referring to "normal" dependencies? If the latter, perhaps we should bring that fix in its own PR and merge it sooner?

Copy link
Contributor Author

@fluiddot fluiddot Jun 24, 2021

Choose a reason for hiding this comment

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

I'm referring to normal dependencies (the ones we have here).

If the latter, perhaps we should bring that fix in its own PR and merge it sooner?

Sure! I'll open a new PR for this 👍 .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the PR where I'm addressing this issue.

@@ -105,6 +105,7 @@
"version": "npm run bundle && git add -A bundle"
},
"dependencies": {
"email-validator": "2.0.4"
"email-validator": "2.0.4",
"@sentry/react-native": "2.4.2"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to use this specific version of the package because we have to match the dependency version of Sentry iOS SDK (reference in version 2.4.2) with the one we have in Automattic-Tracks-iOS.

@fluiddot fluiddot marked this pull request as ready for review June 24, 2021 10:35
Copy link

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

Tested via WordPress/gutenberg#32768 (review)
The code changes LGTM too 🎉

@fluiddot fluiddot requested review from hypest and mchowning July 9, 2021 12:08
@fluiddot fluiddot closed this Mar 11, 2024
@fluiddot fluiddot deleted the add/sentry-react-native branch March 11, 2024 10:48
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.

3 participants