-
-
Notifications
You must be signed in to change notification settings - Fork 252
feat: add tracing to multichain account service #7006
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
base: main
Are you sure you want to change the base?
Conversation
5a26cc8 to
3190bca
Compare
packages/multichain-account-service/src/MultichainAccountWallet.ts
Outdated
Show resolved
Hide resolved
packages/multichain-account-service/src/MultichainAccountWallet.ts
Outdated
Show resolved
Hide resolved
packages/multichain-account-service/src/MultichainAccountWallet.test.ts
Outdated
Show resolved
Hide resolved
packages/multichain-account-service/src/MultichainAccountWallet.ts
Outdated
Show resolved
Hide resolved
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
| @@ -0,0 +1,4 @@ | |||
| export enum TraceName { | |||
| 'SnapDiscoverAccounts' = 'Snap Discover Accounts', | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think Snap* is too generic. Since we're providing the providerName in the trace parameter, maybe we can just use DiscoverAccounts for any providers instead? And we always pass a providerName parameter?
| { | ||
| name: TraceName.EvmDiscoverAccounts, | ||
| data: { | ||
| providerName: this.getName(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just rename providerName to provider in this context
| const mockTrace = jest.fn().mockImplementation(async (request, fn) => { | ||
| expect(request.name).toBe('EVM Discover Accounts'); | ||
| expect(request.data).toStrictEqual({ | ||
| providerName: 'EVM', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use the constant EVM_ACCOUNT_PROVIDER_NAME here
| const mockTrace = jest.fn().mockImplementation(async (request, fn) => { | ||
| expect(request.name).toBe('EVM Discover Accounts'); | ||
| expect(request.data).toStrictEqual({ | ||
| providerName: 'EVM', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, use the constant here too
| ### Changed | ||
|
|
||
| - Adds an optional trace argument to MultichainAccountService and MultichainAccountWallet ([#7006](https://github.com/MetaMask/core/pull/7006)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### Changed | |
| - Adds an optional trace argument to MultichainAccountService and MultichainAccountWallet ([#7006](https://github.com/MetaMask/core/pull/7006)) | |
| ### Added | |
| - Add optional tracing configuration ([#7006](https://github.com/MetaMask/core/pull/7006)) | |
| - For now, only the account discovery is being traced. |
Explanation
This PR adds traces to the Multichain Account Service.
References
Checklist
Note
Adds optional tracing (with fallback) and wraps EVM and snap-based account discovery in trace spans, with comprehensive tests.
config.trace: TraceCallbacktoMultichainAccountService; default totraceFallback.TraceNameenum andtraceFallbackinsrc/analyticsand export viaanalytics/index.EvmAccountProvider.discoverAccountsnow runs within a trace span (EVM Discover Accounts) and constructor accepts optional trace callback.AccountProviderWrapper.discoverAccountstraces usingSnap Discover AccountsorEVM Discover Accountsbased on provider.MultichainAccountService,EvmAccountProvider,AccountProviderWrapper, and analytics utilities.Written by Cursor Bugbot for commit a06ed0a. This will update automatically on new commits. Configure here.