Skip to content

refactor: dedupe sentry trace - #8994

Merged
gambinish merged 10 commits into
mainfrom
perps/dedupe-sentry-trace
Jun 10, 2026
Merged

refactor: dedupe sentry trace#8994
gambinish merged 10 commits into
mainfrom
perps/dedupe-sentry-trace

Conversation

@gambinish

@gambinish gambinish commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Explanation

Gaps to close (likely in the sibling client PRs, not core)

  • late_success/late_error is the taxonomy used, rather than timeout so some dashboards may need to be updated.
  • docs/perps/perps-sentry-reference.md (mobile) still needs updating to describe the new controller-owned trace semantics and the removal of the toast trace.
  • removing usePerpsMeasurement({ traceName: PerpsOrderSubmissionToast }) from usePerpsOrderExecution.ts, deleting the PerpsOrderSubmissionToast TraceName from app/util/trace.ts, and the mobile-side Promise.race.
  • the core tests cover the meaningful equivalents (fast/late success, fast/late error). The literal "timeout" and "navigation-away" cases don't apply in core; that's fine, but the epic's mobile PR should still cover navigation-away at the UI layer if any UI tracing remains.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Touches live order placement tracing and error classification; behavior intentionally keeps orders in flight past 60s, which may shift Sentry dashboards and client expectations.

Overview
Order submission tracing is consolidated in TradingService.placeOrder: a 60s observational threshold (PlaceOrderTimeoutMs) fires a warning breadcrumb and flags slow submissions but does not abort the in-flight provider.placeOrder call (avoiding false failures when the exchange still accepts the order).

The existing Perps Place Order trace now ends with optional reason values: late_success / late_error when the round-trip exceeded the threshold, or error otherwise—including in the catch path after post-provider steps fail. The unused Perps Order Submission Toast name is removed from PerpsTraceName.

New unit tests cover fast vs late success/error and timer cleanup.

Reviewed by Cursor Bugbot for commit 257b132. Bugbot is set up for automated code reviews on this repo. Configure here.

@gambinish
gambinish requested review from a team as code owners June 3, 2026 22:05
@gambinish
gambinish temporarily deployed to default-branch June 3, 2026 22:06 — with GitHub Actions Inactive
Comment thread packages/perps-controller/src/services/TradingService.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 1 potential issue.

Fix All in Cursor

❌ 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 7c35316. Configure here.

Comment thread packages/perps-controller/src/services/TradingService.ts Outdated
@gambinish
gambinish requested a review from aganglada June 8, 2026 20:06
geositta
geositta previously approved these changes Jun 9, 2026

@geositta geositta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one non-blocking question about removing the exported PerpsTraceName literal.

Comment thread packages/perps-controller/src/types/index.ts
@gambinish
gambinish added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 0222b88 Jun 10, 2026
372 checks passed
@gambinish
gambinish deleted the perps/dedupe-sentry-trace branch June 10, 2026 21:26
@cursor cursor Bot mentioned this pull request Jun 11, 2026
4 tasks
pull Bot pushed a commit to dmrazzy/core that referenced this pull request Jun 11, 2026
## Explanation

Releases `@metamask/perps-controller` `8.0.0` → `8.1.0` (minor).

Highlights:
- **Added:** `HYPERLIQUID_ASSET_NAMES` map + `getHyperLiquidAssetName`
helper; relevance-ranked market search (`rankMarketsByQuery`,
`getMarketMatchRank`, `MarketMatchRank`); observational hard timeout for
order submission.
- **Changed:** HyperLiquid positions/orders/balances delivered via
per-DEX `clearinghouseState`/`openOrders` on all paths, dropping the
deprecated `webData2` channel; `PerpsMarketData.name` now
human-readable; bump `@metamask/controller-utils` to `^12.2.0`.
- **Removed:** unused `Perps Order Submission Toast` trace name.
- **Fixed:** `late_error` now emitted whenever the submission threshold
is exceeded in the `placeOrder` catch path.

## References

N/A

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and changelog-only release PR with no source changes; consumer
impact follows the already-merged 8.1.0 feature work described in the
changelog.
> 
> **Overview**
> **Release 1033.0.0** bumps the monorepo and publishes
**`@metamask/perps-controller` 8.1.0** (minor). The diff is version
metadata and changelog only—no application code in this PR.
> 
> The new **8.1.0** changelog section documents what consumers get:
HyperLiquid user data on per-DEX `clearinghouseState` / `openOrders`
instead of deprecated `webData2`; human-readable market names and ranked
search helpers; order-submission observability (`PlaceOrderTimeoutMs`,
`late_success` / `late_error` traces); a fix for `late_error` in
`placeOrder` catch paths; removal of an unused trace name; and
`@metamask/controller-utils` **^12.2.0**. Several entries now point at
the correct upstream PR numbers (e.g. **MetaMask#8994**, **MetaMask#9081**).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0f15380. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants