fix(perps): cp-7.57.0 missing trace attachment in sentry measurements#20817
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
- Remove unnecessary startTime/timestamp parameters from trace/endTrace calls (Let trace system auto-calculate using getPerformanceTimestamp) - Add missing traceSpan parameters to setMeasurement calls - Add complete trace context to getOpenOrders method Fixes in PerpsController.ts: - closePosition: Remove startTime from trace(), add traceSpan to setMeasurement, remove timestamp from endTrace - reportOrderToDataLake: Remove startTime and timestamp parameters - getOpenOrders: Add full trace context matching other data-fetch methods 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Approving to unblock, code looks generally good here |
gambinish
left a comment
There was a problem hiding this comment.
Stamping to unblock the cp. Lmk if you need another approval after CI is green
There was a problem hiding this comment.
Bug: Order Execution Tracking Fails Without `lastResult`
Removing the lastResult state variable broke the usePerpsMeasurement hook in usePerpsOrderExecution.ts. Its endConditions still depend on !!lastResult, causing performance tracking for order execution to never complete.
app/components/UI/Perps/hooks/usePerpsClosePosition.ts#L18-L19
|




Description
What is the reason for the change?
Previous implementation sent Sentry measurements using
setMeasurement()without attaching them to parent spans, causing Sentry to drop measurements or attach them to incorrect spans.What is the improvement/solution?
Fixes measurement attachment by passing the parent
traceSpanparameter to allsetMeasurement()calls.Changelog
CHANGELOG entry: fix missing span attachment to sentry measurements for perps
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1824
Manual testing steps
Screenshots/Recordings
Before
setMeasurement()called without span parameterAfter
setMeasurement(name, duration, 'millisecond', traceSpan)- span attachedPre-merge author checklist
Pre-merge reviewer checklist
Note
Replaces ad-hoc measurements with span-based tracing across Perps UI and backend, attaching all Sentry measurements to proper parent spans and adding granular traces/metrics, analytics, tests, and docs.
measurementNameusage with span-based API (traceName,TraceName,TraceOperation) in UI hooks/views (Markets, Asset Details, Order, Close, Tab, Withdraw, Transactions).usePerpsMeasurementto start/end Sentry spans and mark completion viaendTrace, supporting conditions/reset; deprecates directsetMeasurementtiming there.setMeasurement(..., span)where applicable.PerpsController: wrap operations with unique trace IDs; attach measurements (rewards, data lake, get/open orders, positions, account state, markets, funding) to parent spans; improve error logging and fire-and-forget data lake tracing with retries.PerpsConnectionManager: trace connection establishment and reconnection sub-stages; measure and log preload timings; add health-check sources and retry.PerpsStreamManager/HyperLiquidSubscriptionService: trace WS connects and first-data latencies for positions/orders/account; remove stray console errors, unify logging.Written by Cursor Bugbot for commit e7e41c0. This will update automatically on new commits. Configure here.