-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Cherrypick v12.7.0 feat: Add simulation metrics to "Transaction Submitted" and "Transaction Finalized" events #28314
Merged
danjm
merged 1 commit into
Version-v12.7.0
from
cherrypick-v12.7.0-add-tx-simulation-metrics-for-submitted-and-finalized
Nov 7, 2024
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ion Finalized" events (#28240) ## **Description** This PR adds simulation metrics to the `Transaction Submitted` and `Transaction Finalized` events. Please refer to **Solution B)** below for details. ---- The challenge here is that there are two separate transaction fragment buckets: `transaction-added-<id>` and `transaction-submitted-<id>`. `transaction-added-<id>` fragments are associated with the events: - Transaction Added - Transaction Approved - Transaction Rejected `transaction-submitted-<id>` fragments are associated with the events: - Transaction Submitted - Transaction Finalized Simulation metrics were added to "Transaction Approved" and "Transaction Rejected" events using updateEventFragment. When they were added here through the useTransactionEventFragment hook, the `transaction-submitted-<id>` fragment had not yet been created. The `transaction-submitted-<id>` fragment is created after a user clicks the Confirm button on a transaction which invokes metrics#handleTransactionSubmitted and calls createTransactionEventFragment To solve this, I proposed two solutions (TLDR; went with Solution B): #### Solution A) - Create a single transaction fragment ID to handle all related transaction events. Here, the fragment would specify the props: ``` initialEvent: "Transaction Added" successEvent:"Transaction Finalized" failureEvent: "Transaction Rejected" ``` - Add new method to MetaMetricsController to call trackEvent with specified eventName utilizing fragment props. This would support calling "Transaction Approved" and "Transaction Submitted" ad-hoc style. #### Solution B) - Allow a premature fragment to exist for `transaction-submitted-<id>` fragment. Prior to this PR fragments only exist once they are created. - From useTransactionEventFragment hook - Adds a premature `transaction-submitted-<id>` fragment - Calls "updateEventFragment(`transaction-submitted-${transactionId}`, params)" to store simulation metric props - When handleTransactionSubmitted event is invoked, creating the fragment now merges the premature fragment with the newly created fragment - When a premature fragment is found as an abandoned fragment, we delete it from the store #### Solution C) - store unlinked props in new store state: fragmentsUnlinkedProps on updateEventFragment - fragmentsUnlinkedProps can be applied to newly created fragments on createEventFragment - deleted abandoned fragmentsUnlinkedProps would need more investigation I went with solution B due to time constraints. ## **Related issues** Fixes: MetaMask/MetaMask-planning#3507 ## **Manual testing steps** 1. Turn on "Participate in MetaMetrics" setting 2. Confirm or Reject a Send transaction 3. Observe simulation props are added to `Transaction Submitted` and `Transaction Finalized` events ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> no UI/UX changes ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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.
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [08ec2ab]
Page Load Metrics (2152 ± 62 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
digiwand
added
the
release-12.7.0
Issue or pull request that will be included in release 12.7.0
label
Nov 6, 2024
OGPoyraz
approved these changes
Nov 6, 2024
This was referenced Nov 6, 2024
matthewwalsh0
approved these changes
Nov 7, 2024
danjm
pushed a commit
that referenced
this pull request
Nov 7, 2024
…actions (#28324) <!-- 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** Cherry-picks #28280 into V12.7.0 Discovered this missing behavior while working on #28314. The feat was unexpectedly missing [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28324?quickstart=1) ## **Related issues** Fixes: #28292 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **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** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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.
danjm
deleted the
cherrypick-v12.7.0-add-tx-simulation-metrics-for-submitted-and-finalized
branch
November 7, 2024 15:18
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
release-12.7.0
Issue or pull request that will be included in release 12.7.0
team-confirmations
Push issues to confirmations team
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Cherry-picks #28240 into v12.7.0.
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3507
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist