Skip to content

refactor: add performance tracing infrastructure (#26044) [cherry-pick]#26624

Merged
Gudahtt merged 2 commits intoVersion-v12.1.0from
cherry-pick/add-performance-tracing-infrastructure
Aug 22, 2024
Merged

refactor: add performance tracing infrastructure (#26044) [cherry-pick]#26624
Gudahtt merged 2 commits intoVersion-v12.1.0from
cherry-pick/add-performance-tracing-infrastructure

Conversation

@Gudahtt
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt commented Aug 22, 2024

Cherry-pick of (#26044) for v12.1.0. original description:

Description

Add initial tracing and performance metrics infrastructure.

Specifically:

  • Add the trace method, to be used anywhere in the client to generate a Sentry trace to monitor and analyse performance metrics.
  • Add buttons to the developer settings as an easy mechanism to generate Sentry errors (in the UI or background) and traces.
  • Add the Sentry.browserTracingIntegration to automatically generate traces for each page navigation, including nested spans for any HTTP requests.
  • Update the Sentry debugging documentation in the README.

Note that the previously used browserProfilingIntegration does not generate transactions or traces itself, but rather attempts to add profiling data to any generated transactions. This does not appear to be compatible given it requires the Self-Profiling API object which is only available in Chrome and in our case, the UI. In addition, it requires the js-profiling document policy which also appears to currently not be supported in browser extensions.

Sentry also provides React specific automated instrumentation via @sentry/react and the Sentry.reactRouterV5BrowserTracingInstrumentation integration, but this should be pursued in a separate ticket if needed given the required further refactor.

Open in GitHub Codespaces

Related issues

Fixes: #2711

Manual testing steps

  1. Enable metrics in the settings.
  2. Login to Sentry account.
  3. Go to Traces or Performance section.
  4. Note new transactions or traces named popup.html with nested spans including HTTP requests.

Screenshots/Recordings

Before

After

Sentry Developer Options

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@Gudahtt Gudahtt force-pushed the cherry-pick/fix-sentry-sessions branch from 95ecf1e to eb89eaa Compare August 22, 2024 18:54
@Gudahtt Gudahtt force-pushed the cherry-pick/add-performance-tracing-infrastructure branch from 6fff2e6 to 918a46b Compare August 22, 2024 19:00
Base automatically changed from cherry-pick/fix-sentry-sessions to Version-v12.1.0 August 22, 2024 19:35
Add the `trace` method, to be used anywhere in the client to generate a Sentry trace to monitor and analyse performance metrics.
Add buttons to the developer settings as an easy mechanism to generate Sentry errors (in the UI or background) and traces.
Add the `Sentry.browserTracingIntegration` to automatically generate traces for each page navigation, including nested spans for any HTTP requests.
Update the Sentry debugging documentation in the `README`.
@Gudahtt Gudahtt force-pushed the cherry-pick/add-performance-tracing-infrastructure branch from 918a46b to ade94a6 Compare August 22, 2024 19:35
@Gudahtt Gudahtt marked this pull request as ready for review August 22, 2024 19:39
@Gudahtt Gudahtt requested review from a team and kumavis as code owners August 22, 2024 19:39
import { filterEvents } from './sentry-filter-events';
import extractEthjsErrorMessage from './extractEthjsErrorMessage';

let installType = 'unknown';
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was moved from below (line 16); it's not newly introduced here, it was part of an earlier cherry-pick.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [ade94a6]
Page Load Metrics (55 ± 6 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6212385157
domContentLoaded95924147
load398855136
domInteractive95924147

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 22, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 40 lines in your changes missing coverage. Please review.

Project coverage is 69.80%. Comparing base (6927746) to head (ee12805).

Files Patch % Lines
...ges/settings/developer-options-tab/sentry-test.tsx 51.43% 17 Missing ⚠️
app/scripts/lib/setupSentry.js 15.79% 16 Missing ⚠️
ui/index.js 0.00% 5 Missing ⚠️
shared/lib/trace.ts 90.48% 2 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           Version-v12.1.0   #26624      +/-   ##
===================================================
- Coverage            69.82%   69.80%   -0.02%     
===================================================
  Files                 1368     1370       +2     
  Lines                48670    48739      +69     
  Branches             13429    13438       +9     
===================================================
+ Hits                 33981    34019      +38     
- Misses               14689    14720      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [ee12805]
Page Load Metrics (144 ± 174 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6411690147
domContentLoaded9432094
load391726144363174
domInteractive9422094

@hjetpoluru hjetpoluru self-requested a review August 22, 2024 20:47
@Gudahtt Gudahtt merged commit 42555d3 into Version-v12.1.0 Aug 22, 2024
@Gudahtt Gudahtt deleted the cherry-pick/add-performance-tracing-infrastructure branch August 22, 2024 20:48
@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 2024
@metamaskbot metamaskbot added the release-12.2.0 Issue or pull request that will be included in release 12.2.0 label Aug 28, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

No release label on PR. Adding release label release-12.2.0 on PR, as PR was cherry-picked in branch 12.2.0.

@gauthierpetetin gauthierpetetin added release-12.1.0 Issue or pull request that will be included in release 12.1.0 and removed release-12.2.0 Issue or pull request that will be included in release 12.2.0 labels Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-12.1.0 Issue or pull request that will be included in release 12.1.0

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants