-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: integrate error tracking service with RPC handlers #242
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
Conversation
MoMannn
left a comment
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.
Also some cursor bug bot things to address
… and improve console warning implementation
jeffsmale90
left a comment
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.
Looking really good, and we could probably ship it as is, but I've left a couple minor comments/thoughts/opinions.
…d simplify captureError method
…improve method signatures
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.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
jeffsmale90
left a comment
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.
This looks good to me!
Because we are using this in multiple places, we're having to duplicate the setup logic in the two snaps, so in the future it might be useful to look at doing something like:
const errorTracker = new ErrorTracker({...});
// ...
errorTracker.trackErrors(() => {
// logic in which tracked error may be thrown
});
I don't think we should do this now, but it might be a nice future tidy up.
I fixed the issues he mentioned on the PR and he is out this week.
Description
This PR improves error observability for the gator snap by introducing Sentry-based error tracking via MetaMask.
A new
ErrorTrackerabstraction is added, which reports errors using thesnap_trackErrormethod so that runtime failures inside snaps can be surfaced in Sentry. Sincesnap_trackErrorcurrently only supports a basicerrorpayload and does not expose Sentry-specific features such astags, relevant snap metadata (e.g. snap name) is embedded into the error message itself.On the Sentry side, alerts are configured to filter errors originating from
gator-permissions-snapandpermissions-kernel-snap, and forward those errors to the team via email notifications. This allows us to proactively monitor snap errors and respond more quickly to production issues.Related issues
Fixes: N/A
Manual testing steps
ErrorTrackercallssnap_trackErrorwith the expected error payload.Screenshots/Recordings
Before
After
Email as below
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Medium risk because it changes runtime error-handling paths in both snaps and introduces fire-and-forget calls to
snap_trackError, which could affect observability and (if misused) send sensitiverequest.paramsto tracking.Overview
Adds a shared
SnapErrorTracker(packages/shared/src/utils/errorTracking.ts) that reports errors viasnap_trackError, including structured metadata (snap name, method, URL/status/response data, and request params) embedded in the error message.Wires this tracker into
gator-permissions-snapandpermissions-kernel-snaponRpcRequesthandlers, wrapping execution intry/catchto capture errors asynchronously and then rethrow the original error (with the kernel snap preserving its processing-lock behavior).Updates shared exports/tests and adds
@metamask/snaps-sdktopackages/shareddependencies to support JSON error serialization.Written by Cursor Bugbot for commit e6cc6b0. This will update automatically on new commits. Configure here.