Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: lazy-load sentry #6128

Merged
merged 2 commits into from
Nov 17, 2023
Merged

refactor: lazy-load sentry #6128

merged 2 commits into from
Nov 17, 2023

Conversation

ovflowd
Copy link
Member

@ovflowd ovflowd commented Nov 17, 2023

Description

Sentry has an obnoxious big bundle-size which is non-tree-shakeable (mostly) due to its tracing/replay features.

After pondering a bit I've concluded the following:

  • We don't need Sentry Tracing (Web Vitals / Client-Side Performance Analysis) as we already have Vercel Web Vitals and Performance Analysis (through vercel/analytics)
  • We can lazy-load Sentry, as client-side errors should mostly not happen during-load. By lazy-loading (dynamic imports) we're just reducing the priority that Sentry has during load, and will delegate the Application to bootstrap first rather than Sentry
  • I also disabled Sentry Replays as they use a big bundle size and for our use cases I doubt we really would benefit from Replays
  • This change reduces the initial bundle size (pre-gzip) (and just an estimate) from 240Kb unto 150Kb and the first JS Load from 140 Kb to 90 Kb

Validation

We should still see Sentry reporting Errors on client-side and it should still do /monitoring API calls

@ovflowd ovflowd added the infrastructure Issues/PRs related to the Repository Infra label Nov 17, 2023
@ovflowd ovflowd requested review from a team as code owners November 17, 2023 13:23
Copy link

vercel bot commented Nov 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 17, 2023 11:26pm

sentry.client.config.ts Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Nov 17, 2023

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 100 🟢 97 🟠 83 🟢 92 🔗
/en/about 🟢 100 🟢 95 🟠 83 🟢 92 🔗
/en/about/previous-releases 🟢 100 🟢 96 🟠 83 🟢 92 🔗
/en/download 🟢 100 🟢 97 🟠 83 🟢 92 🔗
/en/blog 🟢 97 🟢 97 🟠 83 🟢 92 🔗

Copy link
Contributor

github-actions bot commented Nov 17, 2023

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 87%
82.91% (398/480) 70.16% (87/124) 69.14% (65/94)

Unit Test Report

Tests Skipped Failures Errors Time
71 0 💤 0 ❌ 0 🔥 5.621s ⏱️

@bmuenzenmeyer
Copy link
Collaborator

  • We don't need Sentry Tracing (Web Vitals / Client-Side Performance Analysis) as we already have Vercel Web Vitals and Performance Analysis (through vercel/analytics)

this thought crossed my mind too 👍

Copy link
Collaborator

@bmuenzenmeyer bmuenzenmeyer left a comment

Choose a reason for hiding this comment

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

all for iterating on what's best

@ovflowd
Copy link
Member Author

ovflowd commented Nov 17, 2023

cc @nodejs/web-infra I'm fast-tracking this for now. We might want to revisit the behaviour of Sentry Tracing as we have a meeting with Sentry next week.

@ovflowd ovflowd enabled auto-merge November 17, 2023 23:32
@ovflowd ovflowd added this pull request to the merge queue Nov 17, 2023
Merged via the queue into main with commit a28951e Nov 17, 2023
13 checks passed
@ovflowd ovflowd deleted the refactor/lazy-load-senty branch November 17, 2023 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Issues/PRs related to the Repository Infra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants