Skip to content

feat: MUSD-1140 add sentry tracing for money account balance service network requests#32995

Open
Matt561 wants to merge 6 commits into
mainfrom
feat/musd-1140-add-sentry-tracing-for-money-account-balance-service-network-requests
Open

feat: MUSD-1140 add sentry tracing for money account balance service network requests#32995
Matt561 wants to merge 6 commits into
mainfrom
feat/musd-1140-add-sentry-tracing-for-money-account-balance-service-network-requests

Conversation

@Matt561

@Matt561 Matt561 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

Wires Sentry tracing into MoneyAccountBalanceService so its network requests show up as spans instead of being invisible to us in production. We had no way to tell how long balance fetches take or spot regressions, so this bumps the service package to 2.2.0 (which adds the trace callback hook) and passes in a callback that tags each span with app foreground/background state and forwards it to our existing trace() util under a new MoneyAccountDataFetch operation.

Changelog

CHANGELOG entry: null

Related issues

Fixes: MUSD-1140: Add Sentry tracing for money-account-balance-service network requests

Manual testing steps

Feature: Money account balance service tracing

  Scenario: user opens the Money home screen
    Given the user has a Money account
    When the app fetches the account balance
    Then a "money.account.data_fetch" span is recorded in Sentry with the current app state

Screenshots/Recordings

N/A — instrumentation-only change, verified via Sentry span output rather than UI.

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

@Matt561 Matt561 marked this pull request as draft July 8, 2026 21:32
@github-actions

github-actions Bot commented Jul 8, 2026

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.

@github-actions github-actions Bot added the size-M label Jul 8, 2026
@socket-security

socket-security Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​metamask/​money-account-balance-service@​2.1.0 ⏵ 2.2.075 +110076 +197 +1100

View full report

@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jul 8, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 391ed87. Configure here.

Comment thread package.json Outdated
Comment thread app/core/Engine/controllers/money-account-balance-service-init.ts Outdated
@Matt561 Matt561 force-pushed the feat/musd-1140-add-sentry-tracing-for-money-account-balance-service-network-requests branch from 391ed87 to 3f7d728 Compare July 10, 2026 16:37
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeMoney
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR makes targeted changes to the Money Account Balance Service:

  1. money-account-balance-service-init.ts: Adds a traceMoneyAccountDataFetch callback to the MoneyAccountBalanceService constructor. This is an observability enhancement that tags balance fetch operations with app state (active/background/inactive) for performance monitoring. No functional logic changes.

  2. trace.ts: Purely additive - adds MoneyAccountDataFetch = 'money.account.data_fetch' to the TraceOperation enum. No existing behavior changed.

  3. package.json: Minor version bump of @metamask/money-account-balance-service from ^2.1.0 to ^2.2.0, which adds the trace callback option to the service.

  4. Test file: Comprehensive unit tests for the new tracing behavior.

  5. yarn.lock: Dependency lock update.

The MoneyAccountBalanceService is the core service responsible for fetching balances for the MetaMask Card/Money Account feature. The package bump (minor version) could introduce behavioral changes beyond just the trace callback. Running SmokeMoney tests validates that the card balance fetching and Money feature flows still work correctly after the package upgrade.

No other E2E areas are affected - this is isolated to the Money/Card feature area with no changes to shared components (navigation, modals, confirmations, browser, etc.).

Performance Test Selection:
The changes are purely observability/tracing additions (new TraceOperation enum value, trace callback integration). The trace callback wraps existing balance fetch operations with telemetry but does not change the underlying fetch logic or introduce new async operations that would impact measured performance metrics. No performance test scenarios are affected by these changes.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@Matt561 Matt561 marked this pull request as ready for review July 10, 2026 19:14
@github-actions github-actions Bot added risk:medium AI analysis: medium risk and removed risk:low AI analysis: low risk labels Jul 10, 2026
@Matt561 Matt561 requested a review from a team July 10, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:medium AI analysis: medium risk size-M team-earn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant