Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Improve provider method metrics for add/switch chain (#28214)
## **Description** The provider metrics for `wallet_addEthereumChain` and `wallet_switchEthereumChain` are tracked more effectively now. They are no longer rate-limited to 0.1%, instead we track 100% of these calls. They also now include the chain ID being added or switched to. It was deemed safe to disable rate limiting here because historically these methods have required user confirmation, so it's not likely that a dapp would send them repeatedly in a short time frame. Volume should be on a similar scale to other manual user confirmations like signatures. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28214?quickstart=1) ## **Related issues** Fixes MetaMask/MetaMask-planning#3520 ## **Manual testing steps** * Build the wallet using the instructions listed here for debugging with the mock Segment API: https://github.com/MetaMask/metamask-extension/blob/develop/development/README.md#debugging-with-the-mock-segment-api * Connect to the test-dapp * Trigger `wallet_addEthereumChain` and `wallet_switchEthereumChain`, and see that they are correctly captured as metric events. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** N/A ### **After** https://github.com/user-attachments/assets/910a1572-74fa-4ecf-8a5d-6f0856757207 Unfortunately the mock Segment server doesn't show the parameters. But it does show that the event was received. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] 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