Skip to content

Conversation

@owencraston
Copy link
Contributor

@owencraston owencraston commented Nov 7, 2025

Description

  1. What is the reason for the change?
  • Properties within segment events are just as important as the events themselves these days. Properties are used to deduplicate events with more details and are often more difficult to test than the mere event.
  • Printing the properties by default will make event testing much easier to debug.
  • This server also did not support logging Identify events which are fired when updating the user properties, logging these make it easier to debug when these properties are updated.
  1. What is the improvement/solution?
  • Pretty print event properties that are fired with the events.
  • This is a developer facing change and will have no impact on users.
  • Add support for event type === identify

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Screenshots/Recordings

Before

// Identify event (not supported)

[mock-segment]: Events received: [Unrecognized event type: identify]
[mock-segment]: POST /v1/batch
[mock-segment]: Events received: Account Menu Opened
[mock-segment]: POST /v1/batch
[mock-segment]: Events received: Account List Page
[mock-segment]: POST /v1/batch
[mock-segment]: Events received: Import Secret Recovery Phrase Page
[mock-segment]: POST /v1/batch
[mock-segment]: Events received: Home
[mock-segment]: POST /v1/batch
[mock-segment]: Events received: DeFi Stats
[mock-segment]: POST /v1/batch
[mock-segment]: Events received: [Unrecognized event type: identify]
...

[mock-segment]: Events received: [Unrecognized event type: identify]
[mock-segment]: POST /v1/batch
[mock-segment]: Events received: Port Stream Chunked
[mock-segment]: POST /v1/batch
[mock-segment]: Events received: Import Secret Recovery Phrase Completed

After

// Identify event

[mock-segment]: Identify event received: 0x51c51cdfc644de86d3df8f612e349787cfd279e485ba472bc59c6a50d18b11f0
{
  "address_book_entries": 12,
  "number_of_accounts": 36,
  "petname_addresses_count": 12
}

// Importing a new wallet

[mock-segment]: Track event received: Account Menu Opened
{
  "location": "Home",
  "category": "Navigation",
  "locale": "en",
  "chain_id": "0xaa36a7",
  "environment_type": "popup"
}
[mock-segment]: Page event received: Account List Page
{
  "params": {},
  "locale": "en",
  "chain_id": "0xaa36a7",
  "environment_type": "popup"
}
[mock-segment]: Page event received: Import Secret Recovery Phrase Page
{
  "params": {},
  "locale": "en",
  "chain_id": "0xaa36a7",
  "environment_type": "popup"
}
[mock-segment]: Page event received: Home
{
  "params": {},
  "locale": "en",
  "chain_id": "0xaa36a7",
  "environment_type": "popup"
}
[mock-segment]: Identify event received: 0x51c51cdfc644de86d3df8f612e349787cfd279e485ba472bc59c6a50d18b11f0
{
  "address_book_entries": 2,
  "number_of_accounts": 4,
  "number_of_hd_entropies": 2,
  "petname_addresses_count": 2
}
[mock-segment]: Track event received: DeFi Stats
{
  "totalMarketValueUSD": 0,
  "totalPositions": 0,
  "breakdown": [],
  "category": "DeFi",
  "locale": "en",
  "chain_id": "0xaa36a7",
  "environment_type": "background"
}
[mock-segment]: Track event received: Profile Activity Updated
{
  "event": {
    "feature_name": "Multichain Account Syncing",
    "action": "group_added",
    "profile_id": "4796375c-f5f1-4868-a761-6ff84eab8bad"
  },
  "category": "Backup And Sync",
  "locale": "en",
  "chain_id": "0xaa36a7",
  "environment_type": "background"
}

.....

[mock-segment]: Track event received: Import Secret Recovery Phrase Completed
{
  "hd_entropy_index": 1,
  "number_of_solana_accounts_discovered": 0,
  "number_of_bitcoin_accounts_discovered": 0,
  "locale": "en",
  "chain_id": "0xaa36a7",
  "environment_type": "background"
}

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

Improves development/mock-segment.js to log each Segment event with type, name/id, and pretty-printed properties, adding support for identify events.

  • Mock Segment Server (development/mock-segment.js):
    • Logs each event individually with type labels (Track, Page, Identify) and name/id.
    • Pretty-prints event data: uses event.properties for non-identify and event.traits for identify.
    • Adds support for identify events and handles unknown types gracefully.
    • Simplifies output by removing request URL/method and aggregate "Events received" summary.

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

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.

@metamaskbot metamaskbot added the team-accounts-framework Accounts Framework team label Nov 7, 2025
@github-actions github-actions bot added the size-S label Nov 7, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [a5f0a5a]
UI Startup Metrics (1209 ± 89 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1209105914188912811363
load104192712228011011187
domContentLoaded103592112087910961181
domInteractive211475121859
firstPaint61588124940710091187
backgroundConnect2292152567232242
firstReactRender27174772943
getState21655102742
initialActions001001
loadScripts81270398379876957
setupStore1163141318
numNetworkReqs1367620671
BrowserifyPower User HomeuiStartup19591739259429522342594
load1035900146818613081468
domContentLoaded1025893145318312861453
domInteractive281670184870
firstPaint59715313234079331323
backgroundConnect24822437033251370
firstReactRender28263422834
getState17715125023185250
initialActions001001
loadScripts789676109716210521097
setupStore11101621116
numNetworkReqs1197425065159250
WebpackStandard HomeuiStartup8277091194908321079
load60755495483603845
domContentLoaded60055093780598834
domInteractive161257101440
firstPaint21958930210206606
backgroundConnect241273132556
firstReactRender291898103437
getState1163141216
initialActions001001
loadScripts59754892778596824
setupStore1162941219
numNetworkReqs1367419870
WebpackPower User HomeuiStartup12951158177316613941773
load670581936119737936
domContentLoaded650571898106701898
domInteractive241362164162
firstPaint34571934266597934
backgroundConnect701226379169263
firstReactRender27243022930
getState1449418524159185
initialActions001011
loadScripts645569888102691888
setupStore1062761127
numNetworkReqs1096916739165167
FirefoxBrowserifyStandard HomeuiStartup14651277187512515231720
load1239109914839212891422
domContentLoaded1239109814829212881422
domInteractive1073526544114203
firstPaint------
backgroundConnect4526186254896
firstReactRender26216362742
getState74344714
initialActions002001
loadScripts1211107814658812671381
setupStore1475581431
numNetworkReqs1266716760
BrowserifyPower User HomeuiStartup24832144329930126773299
load13841167181622016231816
domContentLoaded13841167181522016231815
domInteractive20592586178314586
firstPaint------
backgroundConnect883020862142208
firstReactRender44326585065
getState15310235174171351
initialActions102112
loadScripts13531148174420815811744
setupStore3251213362121
numNetworkReqs1326831372190313
WebpackStandard HomeuiStartup16691456234515217271984
load14161235176711114621640
domContentLoaded14161235176711114611640
domInteractive1053334947119182
firstPaint------
backgroundConnect52231372460112
firstReactRender322389113248
getState84567816
initialActions002011
loadScripts13821217172910514181603
setupStore177103161547
numNetworkReqs1366918766
WebpackPower User HomeuiStartup25312205313830328203138
load15171301180418017121804
domContentLoaded15171301180418017111804
domInteractive16242393123336393
firstPaint------
backgroundConnect883430971113309
firstReactRender443072105272
getState1188518225134182
initialActions101111
loadScripts14831274175317316881753
setupStore4962006963200
numNetworkReqs1295930984200309
📊 Page Load Benchmark Results

Current Commit: a5f0a5a | Date: 11/7/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 986ms (±38ms) 🟢 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 682ms (±36ms) 🟢 | historical mean value: 723ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 74ms (±11ms) 🟢 | historical mean value: 77ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 986ms 38ms 965ms 1.26s 1.01s 1.26s
domContentLoaded 682ms 36ms 663ms 935ms 711ms 935ms
firstPaint 74ms 11ms 64ms 176ms 80ms 176ms
firstContentfulPaint 74ms 11ms 64ms 176ms 80ms 176ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 20 Bytes (0%)

fabiobozzo
fabiobozzo previously approved these changes Nov 10, 2025
Copy link
Contributor

@fabiobozzo fabiobozzo left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@metamaskbot
Copy link
Collaborator

Builds ready [a3d1061]
UI Startup Metrics (1205 ± 105 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12051036155310512631411
load103487313389610911236
domContentLoaded102786713319510861228
domInteractive211475111951
firstPaint708158134140310441155
backgroundConnect2021902459205216
firstReactRender23174752336
getState2186892538
initialActions001001
loadScripts8326821136938931023
setupStore1072121114
numNetworkReqs1367620674
BrowserifyPower User HomeuiStartup19001750236319919522363
load1021889136716312381367
domContentLoaded1013883135816312321358
domInteractive291580214980
firstPaint56418713934029271393
backgroundConnect23722625610246256
firstReactRender27243322733
getState17215519514192195
initialActions001001
loadScripts789661113516010061135
setupStore1292741327
numNetworkReqs1447324971238249
WebpackStandard HomeuiStartup8276981217858431034
load606547100374600776
domContentLoaded59954397670595761
domInteractive16126191441
firstPaint195551004202194732
backgroundConnect241166132757
firstReactRender29186793442
getState1263041420
initialActions001001
loadScripts59654196568593751
setupStore1263451426
numNetworkReqs1467520872
WebpackPower User HomeuiStartup12751163165813913501658
load66757510381397111038
domContentLoaded643564957116682957
domInteractive231367163667
firstPaint30265921239567921
backgroundConnect651122376162223
firstReactRender26242912729
getState1439616723156167
initialActions001001
loadScripts639562947113672947
setupStore1162771227
numNetworkReqs1096717040162170
FirefoxBrowserifyStandard HomeuiStartup15431361209913315751833
load1297115116559813421514
domContentLoaded1296115016559913421514
domInteractive1103549561116220
firstPaint------
backgroundConnect4630146195285
firstReactRender28235342831
getState95486917
initialActions001011
loadScripts1270112615759413201481
setupStore1475181534
numNetworkReqs1266716762
BrowserifyPower User HomeuiStartup25412170355038926883550
load14321175195625116661956
domContentLoaded14321175195625116661956
domInteractive21282684184367684
firstPaint------
backgroundConnect13939748170168748
firstReactRender503279145679
getState1327826349182263
initialActions107217
loadScripts13801153192922215601929
setupStore3461052860105
numNetworkReqs1876532782240327
WebpackStandard HomeuiStartup16801455211314017051996
load14321251190310814991646
domContentLoaded14321250190310814981646
domInteractive1003240446109188
firstPaint------
backgroundConnect50271172054106
firstReactRender312388113144
getState74233815
initialActions001001
loadScripts13991228186810314781570
setupStore16785121541
numNetworkReqs1366817865
WebpackPower User HomeuiStartup26042295307121727553071
load15771409185613216801856
domContentLoaded15771408185513216801855
domInteractive17950446128359446
firstPaint------
backgroundConnect1114424463167244
firstReactRender463196154896
getState1338828859140288
initialActions106116
loadScripts15291305182413816541824
setupStore32577255677
numNetworkReqs1566831983237319
📊 Page Load Benchmark Results

Current Commit: a3d1061 | Date: 11/10/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±57ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 742ms (±54ms) 🟢 | historical mean value: 726ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 80ms (±14ms) 🟢 | historical mean value: 77ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 57ms 1.03s 1.40s 1.09s 1.40s
domContentLoaded 742ms 54ms 717ms 1.06s 759ms 1.06s
firstPaint 80ms 14ms 60ms 208ms 96ms 208ms
firstContentfulPaint 80ms 14ms 60ms 208ms 96ms 208ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 9.76 KiB (0.21%)
  • ui: 7.08 KiB (0.1%)
  • common: 12.75 KiB (0.15%)

@owencraston owencraston added this pull request to the merge queue Nov 10, 2025
Merged via the queue into main with commit 6462cf0 Nov 10, 2025
173 checks passed
@owencraston owencraston deleted the chore/improve-mock-segment-server branch November 10, 2025 20:11
@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2025
@metamaskbot metamaskbot added the release-13.10.0 Issue or pull request that will be included in release 13.10.0 label Nov 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.10.0 Issue or pull request that will be included in release 13.10.0 size-S team-accounts-framework Accounts Framework team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants