Skip to content

fix: set Sentry user id in dedicated metametrics integration, rather than rewriteReport#41191

Merged
gauthierpetetin merged 2 commits into
feat/sentry-metametrics-user-id-3from
feat/sentry-metametrics-user-id-5
Mar 27, 2026
Merged

fix: set Sentry user id in dedicated metametrics integration, rather than rewriteReport#41191
gauthierpetetin merged 2 commits into
feat/sentry-metametrics-user-id-3from
feat/sentry-metametrics-user-id-5

Conversation

@gauthierpetetin

@gauthierpetetin gauthierpetetin commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Description

This PR improves #40491 by setting Sentry user id in dedicated metametrics integration, rather than rewriteReport.

The benefit of this change, is that it would work for pre-initialization errors as well (cf. @Gudahtt 's comment here).

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Related issues

See: #40491

Manual testing steps

See: #40491

Screenshots/Recordings

See: #40491

Pre-merge author checklist

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.

Note

Medium Risk
Changes Sentry event filtering and user identification by moving MetaMetrics opt-in checks and user.id attachment into a new integration, which could affect which events are sent and how they’re attributed (including early-init errors).

Overview
Moves MetaMetrics-aware Sentry behavior out of rewriteReport and into a dedicated integration. The new metaMetricsIntegration drops events when MetaMetrics is disabled and, when opted-in, attaches event.user.id from the same async MetaMetrics state resolution used for gating.

Removes the old filterEvents integration and stops rewriteReport from setting report.user, updating tests accordingly (new sentry-metametrics unit tests; removed setupSentry user-id assertions).

Written by Cursor Bugbot for commit 265ecad. This will update automatically on new commits. Configure here.

- Replace filterEvents with metaMetricsIntegration (sentry-metametrics.ts) using getMetaMetricsState
- Attach user.id in processEvent for async/persisted resolution (incl. pre-init)
- Stop setting user.id in rewriteReport; export MetaMetricsParticipation type
- Add sentry-metametrics.test.ts; slim setupSentry rewriteReport tests

Made-with: Cursor
@gauthierpetetin gauthierpetetin self-assigned this Mar 25, 2026
@gauthierpetetin gauthierpetetin added the team-extension-platform Extension Platform team label Mar 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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.

… arity

processEvent now takes (event, hint, client) per @sentry/types Integration.

Made-with: Cursor
@sonarqubecloud

Copy link
Copy Markdown

@metamaskbotv2

metamaskbotv2 Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor
Builds ready [265ecad]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account31328235628329356
total31328235628329356
Confirm Txconfirm_tx608260786091560846091
total608260786091560846091
Bridge User Actionsbridge_load_page22619126324237263
bridge_load_asset_picker2642512769265276
bridge_search_token75470579329770793
total1266123112872312871287
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Chrome Browserify Startup Standard HomeuiStartup14891274202812115291681
load12331036167410312761400
domContentLoaded12261027166610212691394
domInteractive3018115222691
firstPaint171731248167216296
backgroundConnect22520228915230257
firstReactRender22146072337
initialActions1010124
loadScripts1017823143610010571173
setupStore1474571525
numNetworkReqs403185154177
Chrome Browserify Startup Power User HomeuiStartup5052203115793233056998234
load13401144170813614011630
domContentLoaded13151133167612313771600
domInteractive40212043735140
firstPaint2058751093272349
backgroundConnect183832912008191627524380
firstReactRender27185463035
initialActions106113
loadScripts1081931141811111301349
setupStore1565881731
numNetworkReqs1376527044143248
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2202172222222222
srpButtonToSrpForm98921087104108
confirmSrpToPwForm22212202222
pwFormToMetricsScreen15151501515
metricsToWalletReadyScreen16151611616
doneButtonToHomeScreen52449655823528558
openAccountMenuToAccountListLoaded3004291231369431003136
total39293775407311239924073
Onboarding New WalletcreateWalletToSocialScreen2192172201219220
srpButtonToPwForm1111061153114115
createPwToRecoveryScreen889089
skipBackupToMetricsScreen38383903839
agreeButtonToOnboardingSuccess16151711617
doneButtonToAssetList51647956333546563
total90887795129932951
Asset DetailsassetClickToPriceChart84808738787
total84808738787
Solana Asset DetailsassetClickToPriceChart613387228587
total613387228587
Import Srp HomeloginToHomeScreen2319228623592723232359
openAccountMenuAfterLogin665481107481
homeAfterImportWithNewWallet1227380240691222732406
total36702802477487146774774
Send TransactionsopenSendPageFromHome33273853738
selectTokenToSendFormLoaded31243543535
reviewTransactionToConfirmationPage1048907128214211331282
total1119983134313612001343
SwapopenSwapPageFromHome29204073440
fetchAndDisplaySwapQuotes269426872706726932706
total2730271227531427392753
🌐 Dapp Page Load Benchmarks

Current Commit: 265ecad | Date: 3/25/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±40ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 725ms (±38ms) 🟢 | historical mean value: 742ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 80ms (±11ms) 🟢 | historical mean value: 87ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 40ms 1.03s 1.36s 1.07s 1.36s
domContentLoaded 725ms 38ms 704ms 1.02s 748ms 1.02s
firstPaint 80ms 11ms 64ms 164ms 92ms 164ms
firstContentfulPaint 80ms 11ms 64ms 164ms 92ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 6.84 MiB (100%)
  • ui: 8.35 MiB (100%)
  • common: 11.34 MiB (100%)

@gauthierpetetin gauthierpetetin mentioned this pull request Mar 25, 2026
7 tasks
@gauthierpetetin gauthierpetetin merged commit 19b01fd into feat/sentry-metametrics-user-id-3 Mar 27, 2026
199 checks passed
@gauthierpetetin gauthierpetetin deleted the feat/sentry-metametrics-user-id-5 branch March 27, 2026 14:26
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-M team-extension-platform Extension Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant