Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add metrics for provider calls coming from ppom on extension (#…
…21482) ## **Description** We need to add metrics to help measure and estimate the usage and cost of Infura by ppom. This fix uses the `providerRequestsCount` object returned as part of the securityAlertResponse of transaction object and gets only the keys that matches the below specified requests. ### Proposal Add new properties to Transactions and Signature events where which property will count the number of rpc requests made by ppom to evaluate that specific transaction or signature. - [x] `ppom_eth_call_count` - counts the number of eth_call rpc requests made by ppom to evaluate that transaction or signature - [x] `ppom_eth_createAccessList_count` - counts the number of eth_call rpc requests made by ppom to evaluate that transaction or signature - [x] `ppom_eth_getStorageAt_count` - counts the number of eth_call rpc requests made by ppom to evaluate that transaction or signature - [x] `ppom_eth_getCode_count` - counts the number of eth_call rpc requests made by ppom to evaluate that transaction or signature - [x] `ppom_eth_getTrasanctionCount_count` - counts the number of eth_call rpc requests made by ppom to evaluate that transaction or signature - [x] `ppom_eth_getBalance_count` - counts the number of eth_call rpc requests made by ppom to evaluate that transaction or signature - [x] `ppom_trace_call_count` - counts the number of eth_call rpc requests made by ppom to evaluate that transaction or signature ### References - [ppom provider usage benchmark](https://wobbly-nutmeg-8a5.notion.site/MM-JSON-RPC-Benchmark-37d4a3bd74914b0fbe9147582c0cde51) - [ppom required json-rpcs](https://docs.google.com/document/d/1aOjVIsGHc0twc96V82OcXmpduGKrPjRScL_jwfgjkj0/edit?usp=sharing) ## **Manual testing steps** 1. Start extension with blockaid enabled 2. Go to test-dapp and initiate a blockaid transaction 3. When blockaid banner is shown, check that the above keys (or some of it at least) are part of the metrics transaction or signature events Fixes [#1357](https://github.com/MetaMask/MetaMask-planning/issues/1357) ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained: - [x] What problem this PR is solving. - [x] How this problem was solved. - [x] How reviewers can test my changes. - [x] I’ve indicated what issue this PR is linked to: Fixes #??? - [ ] I’ve included tests if applicable. - [x] I’ve documented any added code. - [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)). - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **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