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

feat(nextjs/vercel-edge/cloudflare): Switch to OTEL for performance monitoring #13889

Draft
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

lforst
Copy link
Member

@lforst lforst commented Oct 7, 2024

This PR is a collection of PRs enabling OTEL tracing for @sentry/nextjs, @sentry/vercel-edge, and by extension @sentry/cloudflare.

Tasks:

**This PR is part of a stacked PR sequence as we need to do many changes
at once for #8105.
Merging this PR as is will create inconsistent data.**

---

This PR will make the `@sentry/vercel-edge` SDK use OpenTelemetry
performance under the hood.

We need to employ a few hacks so that OpenTelemetry works on a worker
runtime:
- We are vendoring the OTEL `AsyncLocalStorageContextManage` because the
original implementation depends on `AsyncLocalStorage` as exported from
`async_hooks` which is not available in workers. In our vendored version
we are taking it from `globalThis.AsyncLocalStorage`.
- We are polyfilling `performance` with `Date.now()` as that API is not
available in worker runtimes.

Resolves #13740
Copy link
Contributor

github-actions bot commented Oct 7, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 22.73 KB - -
@sentry/browser - with treeshaking flags 21.53 KB - -
@sentry/browser (incl. Tracing) 35.12 KB - -
@sentry/browser (incl. Tracing, Replay) 71.83 KB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.23 KB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 76.19 KB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 88.97 KB - -
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 90.8 KB - -
@sentry/browser (incl. metrics) 27 KB - -
@sentry/browser (incl. Feedback) 39.87 KB - -
@sentry/browser (incl. sendFeedback) 27.38 KB - -
@sentry/browser (incl. FeedbackAsync) 32.17 KB - -
@sentry/react 25.49 KB - -
@sentry/react (incl. Tracing) 38.09 KB - -
@sentry/vue 26.91 KB - -
@sentry/vue (incl. Tracing) 37.02 KB - -
@sentry/svelte 22.87 KB - -
CDN Bundle 24.11 KB - -
CDN Bundle (incl. Tracing) 36.96 KB - -
CDN Bundle (incl. Tracing, Replay) 71.62 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 76.96 KB - -
CDN Bundle - uncompressed 70.7 KB - -
CDN Bundle (incl. Tracing) - uncompressed 109.73 KB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 222.17 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 235.38 KB - -
@sentry/nextjs (client) 38.06 KB - -
@sentry/sveltekit (client) 35.74 KB - -
@sentry/node 124.95 KB -0.16% -197 B 🔽
@sentry/node - without tracing 94.01 KB -0.26% -246 B 🔽
@sentry/aws-serverless 103.61 KB -0.19% -200 B 🔽

View base workflow run

…13890)

Simply moves all runtime agnostic instrumentation related to the pages
router into its own folder.
@AbhiPrasad AbhiPrasad self-requested a review October 7, 2024 12:50
chargome and others added 3 commits October 8, 2024 15:55
…13904)

Drop all spans/transactions emitted by Next.js for pages router API
routes because they are currently super buggy with wrong timestamps. Fix
pending: vercel/next.js#70908

This is just a bit of prep-work so we can at some point disable the
logic where we turn on all Next.js spans and still have high quality
data.
Disables the instrumentation for incoming HTTP requests to be consistent
across Next.js versions for instrumentation.

Next 13 and 15 work with the HTTP instrumentation. 14 doesn't.
…time (#13919)

We need to hoist the isolation scope forking logic out of the build-time
instrumentation.
…runtime (#13921)

We need to hoist the isolation scope forking logic out of the build-time
instrumentation.
Copy link

codecov bot commented Oct 10, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
627 1 626 37
View the top 1 failed tests by shortest run time
server-components.test.ts Sends a transaction for a request to app router
Stack Traces | 0.464s run time
server-components.test.ts:4:5 Sends a transaction for a request to app router

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants