Uh oh!
There was an error while loading. Please reload this page.
feat(bridge): add quote and operation performance telemetry - #9899
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
bfullam
commented
Aug 18, 2026
@metamaskbot publish-preview |
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.
Uh oh!
There was an error while loading. Please reload this page.
Include feature-flow context on provider, approval, submission, and operation spans so Sentry dashboard panels can be segmented consistently.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Prevent provider performance telemetry from delaying quote processing or state updates.
Keep provider tracing non-blocking without adding an uncovered promise handler.
Align streaming provider traces with the end-to-end first usable quote timing.
bfullam
commented
Aug 19, 2026
@metamaskbot publish-preview |
bfullam
commented
Aug 20, 2026
@metamaskbot publish-preview |
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 f7d67b0. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Cover non-EVM publish completion and prevent duplicate intent operation spans without changing persisted history state.
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |

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.