Skip to content

Enable Sentry module treeshaking

Miguel Rincon requested to merge 339332-enable-sentry-treeshaking into master

What does this MR do and why?

This change migrates the global Sentry initialization in favor of a more granular approach to settting it up.

See more at:

https://docs.sentry.io/platforms/javascript/configuration/tree-shaking/#tree-shaking-default-integrations

MRs in this change chain
Enable Sentry module treeshaking (!130677 - merged) your are here
Upgrade sentry browser SDK to 7.66.0 (!130678 - merged)
Adds Sentry browser performance tracing (!130713 - merged)

Why this change?

In our next step, we will upgrade to the latest version of Sentry. In the new version the package size has increased significantly with the addition of Sentry replay. The upgrade is happening at !130678 (merged) and I am monitoring the bundle size there as well.

Screenshots or screen recordings

before after
image image

The only difference in the configuration is the sendClientReports: true, that is already enabled by default 👍

How to set up and validate locally

One easy way to validate in GDK is to enable Sentry and check it gets configured in the browser console:

  1. Enable the feature flag: enable_new_sentry_integration
  2. Visit http://gdk.test:3000/admin/application_settings/metrics_and_profiling#js-sentry-settings
  3. Fill the form with some dummy data, ensuring "Enable Sentry error tracking" is turned on.
  4. Print the following values in your console:
__SENTRY__.hub._stack[0].client._dsn
__SENTRY__.hub._stack[0].client._options

Local E2E test

I also did a manual E2E test to verify the errors are captured correctly in my GDK

https://new-sentry.gitlab.net/organizations/gitlab/issues/335835/?environment=development&project=4&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=1h&stream_index=0

image

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #339332 (closed)

Edited by Miguel Rincon

Merge request reports