chore: add advanced charts traces cp-7.76.0#29497
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. |
NicolasMassart
left a comment
There was a problem hiding this comment.
found a small bug that may degrade data collection quality for impatient users (not waiting for the skeleton to disapear).
This is not critical but also not so hard to fix.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 eb2a3e0. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
None of these changes affect core wallet functionality, transaction flows, account management, network management, or any other E2E-testable user flows. The changes are purely internal performance instrumentation and analytics consent cache improvements. No E2E test tags are warranted. Performance Test Selection: |
|
NicolasMassart
left a comment
There was a problem hiding this comment.
Looks good to me.




Description
Adds Sentry performance traces for token-overview advanced chart visibility (time from series change until skeleton clears), with separate trace types for dashboards to distinguish initial load / asset or currency changes from time-range-only updates.
Also fixes a bug in metrics consent detection during early Sentry initialization.
Changes
Advanced Chart Performance Tracing
AdvancedChart component:
onSkeletonHiddencallback that fires once when loading/layout settles and the chart is readyPriceAdvanced component:
trace()whenohlcvSeriesKeychangesendTrace()when:getAdvancedChartVisibilityTraceRequest()selects appropriateTraceNameandTraceOperationbased on what changed:TokenOverviewAdvancedChartTimeRangeVisibletraceTokenOverviewAdvancedChartInitialVisibletracetrace.ts:
TraceNamevalues:TokenOverviewAdvancedChartInitialVisible- for initial load or asset/currency changesTokenOverviewAdvancedChartTimeRangeVisible- for time range selector changes onlyTraceOperationvalues:token_overview.advanced_chart- initial load or asset/currency changetoken_overview.advanced_chart_time_range- time range change onlyMetrics Consent Fix
Problem:
The original implementation attempted to read from
analytics.isEnabled()during Sentry initialization inindex.js:45. However, this occurs before Engine and Redux are initialized, causinganalytics.isEnabled()to incorrectly returnfalseeven for opted-in users (it checks in-memory state that doesn't exist yet).Solution:
hasMetricsConsent()now reads directly from AnalyticsController's persisted state in FilesystemStorage (persist:AnalyticsController) before falling back to the legacyMETRICS_OPT_INstorage key. This approach:{"optedIn": true/false})ControllerStorage.getAllPersistedState()inpersistConfig/index.tsMETRICS_OPT_INas the primary sourceMetaMetricsAndDataCollectionSection:
updateCachedConsent()when user toggles analytics participationChangelog
CHANGELOG entry: Adds tracing for advanced charts
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3129
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Adds new Sentry tracing lifecycle hooks around the token overview advanced chart and changes how metrics consent is determined during early app startup, which could affect whether performance data is captured or suppressed.
Overview
Adds Sentry performance traces for token overview advanced chart visibility, starting a trace on
ohlcvSeriesKeychanges and ending it when the chart skeleton disappears, errors, is superseded by a newer request, falls back to the legacy chart, or unmounts (includingassetIdand truncated error details).Extends
AdvancedChartwith anonSkeletonHiddencallback that fires once when the native skeleton overlay is removed (resetting on series/HTML reload), and adds newTraceName/TraceOperationconstants to distinguish initial/asset changes vs time-range-only updates.Fixes early Sentry init consent detection by updating
hasMetricsConsent()to readpersist:AnalyticsControllerfromredux-persist-filesystem-storage(fallback to legacyMETRICS_OPT_IN), and keeps the in-memory consent cache in sync viaupdateCachedConsent()from settings; tests were updated/added for these behaviors.Reviewed by Cursor Bugbot for commit 7ec6bbd. Bugbot is set up for automated code reviews on this repo. Configure here.