feat(bridge): add quote and operation performance telemetry - #9899
Open
bfullam wants to merge 10 commits into
Open
feat(bridge): add quote and operation performance telemetry#9899bfullam wants to merge 10 commits into
bfullam wants to merge 10 commits into
Conversation
Add explicit quote outcomes and provider first-result traces so Swaps and Bridge quote latency and reliability can be measured in Sentry.
Add backdated success and error telemetry for single-chain and cross-chain swap operations, including route, provider, result, and terminal-stage dimensions. Guard terminal state transitions to keep completion state and traces idempotent.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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 019ac53. Configure here.
Keep provider and aggregate quote traces best effort so rejected telemetry callbacks cannot clear fetched quotes or interrupt quote refresh state.
Restore existing terminal-event handling and make abort coverage await the asynchronous rejection while retaining the Sentry instrumentation.
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Keep swap_type on provider and unified operation traces, where it adds flow context, but omit it from aggregate traces whose names already identify the flow.
…aces Use the backdated trace start time as the single duration boundary instead of duplicating the measurement as a custom attribute.
Include feature-flow context on provider, approval, submission, and operation spans so Sentry dashboard panels can be segmented consistently.
micaelae
reviewed
Aug 18, 2026
micaelae
reviewed
Aug 18, 2026
Prevent provider performance telemetry from delaying quote processing or state updates.
Keep provider tracing non-blocking without adding an uncovered promise handler.
infiniteflower
previously approved these changes
Aug 19, 2026
Align streaming provider traces with the end-to-end first usable quote timing.
Contributor
Author
|
@metamaskbot publish-preview |
micaelae
approved these changes
Aug 19, 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
The existing Swaps and Bridge controller traces do not provide a complete, reliable performance picture: quote traces conflate expected cancellations with failures, provider latency is not attributable to individual routers, and transaction traces end at submission rather than operation completion.
This PR adds the Core instrumentation required for SWAPS-4935:
success,cancelled,no_quotes, anderroroutcomes to non-Batch Sell quote traces.Quote Provider First Resulttraces, deduplicated by normalized provider and correlated to the parent request.Swap Operation Completedtrace for single-chain and cross-chain operations, withswap_type,terminal_stage, result, route, provider, identifiers, and submission-to-terminal duration.Mobile package consumption and the remaining Mobile-owned trace hardening are follow-up work in SWAPS-4935.
References
Checklist
Test plan
yarn exec oxfmton changed Core filesyarn workspace @metamask/bridge-controller run buildyarn workspace @metamask/bridge-status-controller run buildyarn workspace @metamask/bridge-status-controller run changelog:validateNote
Low Risk
Observability-only changes with guarded trace callbacks; quote and status business logic paths are largely unchanged aside from classification of aborts and new telemetry hooks.
Overview
Adds Sentry-oriented performance telemetry for swap/bridge quote fetching and end-to-end operations (SWAPS-4935).
Bridge controller: Quote fetch tracing is reworked so aggregate traces (
Bridge Quotes Fetched/Swap Quotes Fetched) run in afinallyblock with explicitresultvalues (success,cancelled,no_quotes,error), correlatedrequest_id(UUID), andfeature_id. Expected aborts are classified viaisExpectedQuoteAbortinstead of being treated like failures. New backdatedQuote Provider First Resulttraces fire once per normalized provider on the first quote (SSE and non-SSE), linked to the parent request. Trace emission is wrapped so telemetry errors cannot break quote fetching.Bridge status controller: Introduces
Swap Operation Completedbackdated traces when operations reach a terminal state—same-chain on source tx success/failure, cross-chain on Bridge API status completion—withswap_type,terminal_stage, provider, ids, hashes, andduration_msfromstartTimeto completion.Changelogs and focused Jest coverage document the new trace shapes and scenarios.
Reviewed by Cursor Bugbot for commit 27f1175. Bugbot is set up for automated code reviews on this repo. Configure here.