Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add performance tracing infrastructure (#11132)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> - Add initial tracing and performance metrics infrastructure. Add the `trace`, `endTrace` methods, to be used anywhere in the mobile code to generate a Sentry traces. Implementation is almost same as we have in the extension. The only difference is in extension `withIsolatedScope`, in mobile `withScope` is used because `@sentry/browser` version mismatch in `@sentry/react-native`. This is also noted in the `trace.ts` file. - Add developer options to settings (similar settings [added in extension](https://github.com/MetaMask/metamask-extension/blob/e858167bb1fee33d4d0be1ab2f8e1ce2b11c7945/ui/pages/settings/developer-options-tab/developer-options-tab.tsx#L50) ) This adds an easily accessible development action menu where devs wants to test some functionality locally. Specifically this PR adds generating nested traces in Sentry. - New environment variables: `MM_ENABLE_SETTINGS_PAGE_DEV_OPTIONS` : Needs to be set to `true` in order to show `Developer Options` in the settings page `MM_SENTRY_DSN_DEV` : This is explicitly set for `test-metamask` project and the expected value is in the `.js.env.example` ## **Related issues** Fixes: MetaMask/mobile-planning#1877 ## **Manual testing steps** 1. Go to settings page tab `Developer Options` 2. Tab `Generate Trace Test` 3. Open `https://metamask.sentry.io/traces/?project=273496&statsPeriod=15m`, in this link you will be able to see traces that have been send to `test-metamask` in last 15 minutes 4. See `Developer Test` trace is triggered ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [X] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [X] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [X] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
- Loading branch information