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

fix: "Transaction Finalized" metrics event on transaction confirmation #24338

Merged
merged 4 commits into from
May 2, 2024

Conversation

danjm
Copy link
Contributor

@danjm danjm commented May 2, 2024

0de97df brought in a number of breaking changes as it updated the transaction controller.

One of the breaking changes was changing the shape of the object included in the event when a transaction is confirmed:
Screenshot from 2024-05-02 01-59-38
(https://github.com/MetaMask/core/pull/3827/files#diff-96bc10c64242a8e23f5835532988319189239bdf40f556b86199dcbcc41c7bfcL1353-R1646)

The handleTransactionConfirmed handler in app/scripts/lib/transaction/metrics.ts was not updated to accommodate this difference. So its if (!transactionEventPayload.transactionMeta) { condition was always being hit, and the function was returning early. This PR corrects that, and thereby fixes the "Transaction Finalzied" event

Description

Open in GitHub Codespaces

Related issues

Fixes: #24339

Manual testing steps

  1. Setup metamask so that it will send metrics events. This requires building with the SEGMENT_WRITE_KEY set, and setting "Participate in MetaMetrics" to true.
  2. Open the background console and the network tab
  3. Go through the send flow and confirm a transaction
  4. Once it is no longer pending and is confirmed, you should see a network request to segment, with "Transaction Finalized" in the payload

Screenshots/Recordings

tx-finalized-metrics.mp4
  • I’ve followed MetaMask Coding Standards.
  • 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 format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). 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.

…ransaction meta object, as opposed to excepting it to have the transaction meta object as a property. This handles the breaking change brought in with 0de97df
Copy link
Contributor

github-actions bot commented May 2, 2024

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.

@danjm danjm changed the title Update handleTransactionConfirmed to handle the eventPayload as the t… Fix "Transaction Finalized" metrics event on transaction confirmation May 2, 2024
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label May 2, 2024
@danjm danjm marked this pull request as ready for review May 2, 2024 04:34
@danjm danjm requested a review from a team as a code owner May 2, 2024 04:34
@danjm danjm changed the title Fix "Transaction Finalized" metrics event on transaction confirmation fix: "Transaction Finalized" metrics event on transaction confirmation May 2, 2024
@danjm danjm added team-extension-platform team-confirmations Push issues to confirmations team labels May 2, 2024
@hjetpoluru hjetpoluru self-requested a review May 2, 2024 11:08
Copy link
Contributor

@hjetpoluru hjetpoluru left a comment

Choose a reason for hiding this comment

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

I tested and see the 'Transaction Finalized' event for both the successful and failed transactions.

Screenshot 2024-05-02 at 10 14 15 AM

@hjetpoluru hjetpoluru mentioned this pull request May 2, 2024
9 tasks
@metamaskbot
Copy link
Collaborator

Builds ready [756f043]
Page Load Metrics (1097 ± 681 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint59212984019
domContentLoaded9109232612
load52380310971419681
domInteractive9109232612
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 32 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.32%. Comparing base (945750d) to head (756f043).
Report is 7 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #24338   +/-   ##
========================================
  Coverage    67.32%   67.32%           
========================================
  Files         1276     1276           
  Lines        49739    49739           
  Branches     12925    12925           
========================================
  Hits         33482    33482           
  Misses       16257    16257           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Seems like this one slipped through the cracks 😞 Fix makes sense to me.

@danjm danjm merged commit 9a7f82a into develop May 2, 2024
71 checks passed
@danjm danjm deleted the fix-tx-finalized-metrics branch May 2, 2024 17:10
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2024
@metamaskbot metamaskbot added release-11.18.0 release-11.14.5 Issue or pull request that will be included in release 11.14.5 and removed release-11.18.0 labels May 2, 2024
@metamaskbot
Copy link
Collaborator

Missing release label release-11.14.5 on PR. Adding release label release-11.14.5 on PR and removing other release labels(release-11.18.0), as PR was cherry-picked in branch 11.14.5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template release-11.14.5 Issue or pull request that will be included in release 11.14.5 team-confirmations Push issues to confirmations team team-extension-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Transaction Finalized" metrics events not being sent on transaction confirmation
5 participants