Skip to content

fix(perps): target preload performance measurements - #9906

Merged
abretonc7s merged 3 commits into
mainfrom
fix/perps-sentry-span-targeting
Aug 19, 2026
Merged

fix(perps): target preload performance measurements#9906
abretonc7s merged 3 commits into
mainfrom
fix/perps-sentry-span-targeting

Conversation

@abretonc7s

@abretonc7sabretonc7s commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description

Targets Perps preload measurements to their named trace IDs, exposes a post-hydration controller construction timestamp to clients, and removes the wallet address from user-preload trace data. This is the minimal Core contract required by the Perps loading dashboard; market and account bootstrap behavior is unchanged.

Changelog

  • Added optional Perps performance hooks for controller construction and explicit trace-targeted measurements.
  • Removed wallet addresses from Perps user-preload traces.

Validation

  • Focused PerpsController Jest: 3 passed
  • Targeted ESLint: passed
  • Prettier and git diff checks: passed
  • Repository pre-push lint is locally blocked by unrelated untracked harness overlays and tsc cache files; GitHub CI is the clean full-repository gate.

Related

Follow-up to #9815.


Note

Low Risk
Telemetry and optional DI hooks only; preload and trading paths are unchanged aside from trace targeting and PII removal from traces.

Overview
Extends the Perps observability contract for the loading dashboard without changing market or account bootstrap behavior.

PerpsPerformance gains an optional onControllerConstructed callback, invoked once after synchronous disk hydration in the constructor with performance.now() (no Sentry write at construct time).

PerpsTracer.setMeasurement is typed as an overload that accepts an optional fourth id argument; market and user preload paths now pass the same traceId used when opening those named traces so durations attach to the correct span.

User data preload no longer puts userAddress on the Perps User Data Preload trace data or in debug logs tied to that flow, reducing PII in telemetry while fetch behavior is unchanged.

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

@abretonc7sabretonc7s self-assigned this Aug 18, 2026
@abretonc7s
abretonc7s added this pull request to the merge queueAug 19, 2026
Merged via the queue into main with commit 10d8c79Aug 19, 2026
46 checks passed
@abretonc7s
abretonc7s deleted the fix/perps-sentry-span-targeting branch August 19, 2026 07:40
@abretonc7sabretonc7s mentioned this pull request Aug 19, 2026
4 tasks
pullBot pushed a commit to dmrazzy/core that referenced this pull request Aug 19, 2026
## Explanation
Release `@metamask/perps-controller` **12.1.0**. No other packages.
Minor bump. New public API:
- Optional `PerpsPerformance.onControllerConstructed` post-hydration
hook
- `PerpsTracer.setMeasurement` overload that takes a trace ID
- `PERPS_EVENT_PROPERTY.PREVIOUS_LEVERAGE` (`previous_leverage`)
Also retargets market/user preload measurements onto their named traces
and drops wallet addresses from user-preload trace data.
No breaking changes. Existing 3-arg `setMeasurement` callers and clients
that omit the new hook keep compiling.
## References
- MetaMask#9906
- MetaMask#9881
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] 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
Sign up for freeto 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.

2 participants

@abretonc7s@michalconsensys