feat: added tracing for money-account-balance-service network requests#9434
Merged
Merged
Conversation
…rapped network calls with traces
10 tasks
Contributor
Author
|
@metamaskbot publish-previews |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Kureev
approved these changes
Jul 9, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation
Added optional tracing for network requests in money-account-balance-service.
Changes
tracearg to money-account-balance-service constructor.traceNetworkRequestwhich runs a network request and emits a best-effort backdated trace. Tracing failure does not impact our queries.traceNetworkRequestReferences
Fixes: MUSD-1140: Add Sentry tracing for money-account-balance-service network requests
Checklist
Note
Low Risk
Additive optional API with no-op default; tracing is isolated from fetch/retry logic and covered by tests, so balance and APY behavior should be unchanged when trace is not provided or fails.
Overview
Adds optional observability for
MoneyAccountBalanceServicevia a new constructortracecallback, aimed at wiring Sentry (or similar) without changing balance/APY behavior when tracing is omitted or fails.A private
#traceNetworkRequesthelper runs each real network call, then emits a backdated trace withstartTime,chainId,operation,success, and optionalerrorName/tokenAddress. Trace emission is best-effort (async, errors logged only); query failures still propagate, and cached hits do not trace.RPC and HTTP paths are wrapped: ERC-20
balanceOf, Accountantbase/getRate, Multicall3aggregate3, LensbalanceOfInAssets, and the Veda vault APYfetch. Named trace constants (TRACES) and exported types (MoneyAccountBalanceServiceOptions, trace callback/request) support consumers. Changelog and a broadtracingtest suite cover success, cache skip, trace callback failures, and failed requests.Reviewed by Cursor Bugbot for commit 975339c. Bugbot is set up for automated code reviews on this repo. Configure here.