GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(nextjs): Use spans generated by Next.js for App Router by lforst · Pull Request #12729 · getsentry/sentry-javascript

Conversation

@lforst

@lforst lforst commented Jul 2, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Previously when we attempted to use the OTEL tracing provided by Next.js we faced data quality issues. The problem was that we used to look at the data holistically and not in isolation. We discovered that certain data provided by Next.js is actually more accurate than the data we collect, in particular the data we collect for app router SSR requests.

With this PR we start using OTEL data for app router SSR requests. We do this by allow-listing spans created for these requests by Next.js so that we are only capturing these spans/traces.

With this PR, we're starting to use our/otel's HTTP instrumentation (only for app router SSR requests!) so we can capture the most accurate data.

There are a few gotchas:

  • Next.js emits multiple "GET /bla/bla" spans when middleware is used. We are renaming those to avoid collisions with our own HTTP spans.
  • Our HTTP instrumentation doesn't capture parameterized routes as span names and Next.js does. We will grab the parameterized routes off the Next.js spans and hoist them into our own HTTP spans.

Traces look like this now:

Screenshot 2024-07-05 at 12 32 54

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Luca Forstner added 13 commits July 2, 2024 13:13
Luca Forstner
this will break in a million ways
7034d96
Luca Forstner
Apply isolation scope to transaction
c4fc30b
Luca Forstner
Fix generation function tests
e4b3f1d
Luca Forstner
Fix request instrumentation tests
5bd6e0b
Luca Forstner
Fix next-15 e2e tests
d35762a
Luca Forstner
Fix some nextjs-app-dir tests
79fabbf
Luca Forstner
test: Fix e2e test race condition by buffering events
1cdfdc9
Luca Forstner
Merge branch 'lforst-event-proxy-no-race-condition' into lforst-otel-…
f98a72f
…for-nextjs
Luca Forstner
Merge branch 'develop' into lforst-otel-for-nextjs
8737b7e
Luca Forstner
stuff
9ca8137
Luca Forstner
interesting
0ba02be
Luca Forstner
Merge branch 'develop' into lforst-otel-for-nextjs
cda4fb3
Luca Forstner
wut
8e75acf
@lforst
lforst marked this pull request as ready for review July 4, 2024 07:33
@lforst

lforst commented Jul 4, 2024

Copy link
Copy Markdown
Contributor Author

This is ready for review, just need to figure out why 1 e2e test is failing.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lforst
lforst requested review from AbhiPrasad, andreiborza, chargome and mydea July 4, 2024 07:34
chargome
chargome reviewed Jul 4, 2024
View reviewed changes
Comment thread packages/nextjs/src/server/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

mydea
mydea reviewed Jul 4, 2024
View reviewed changes
Comment thread packages/nextjs/src/common/wrapGenerationFunctionWithSentry.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Luca Forstner
test
18fe54d
mydea
mydea approved these changes Jul 4, 2024
View reviewed changes

@mydea mydea left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

pretty cool!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
chargome
chargome approved these changes Jul 4, 2024
View reviewed changes

@chargome chargome left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Nice! Does this have any effect on page routes as well?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Luca Forstner added 2 commits July 4, 2024 11:04
Luca Forstner
Merge branch 'develop' into lforst-otel-for-nextjs
a3146c9
Luca Forstner
.
d4aa8f1
@github-actions

github-actions Bot commented Jul 4, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
@sentry/browser 22.28 KB (0%)
@sentry/browser (incl. Tracing) 33.43 KB (0%)
@sentry/browser (incl. Tracing, Replay) 69.18 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.51 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 73.24 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 85.87 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 87.73 KB (0%)
@sentry/browser (incl. metrics) 26.57 KB (0%)
@sentry/browser (incl. Feedback) 38.93 KB (0%)
@sentry/browser (incl. sendFeedback) 26.9 KB (0%)
@sentry/browser (incl. FeedbackAsync) 31.52 KB (0%)
@sentry/react 25.02 KB (0%)
@sentry/react (incl. Tracing) 36.46 KB (0%)
@sentry/vue 26.39 KB (0%)
@sentry/vue (incl. Tracing) 35.29 KB (0%)
@sentry/svelte 22.41 KB (0%)
CDN Bundle 23.5 KB (0%)
CDN Bundle (incl. Tracing) 35.19 KB (0%)
CDN Bundle (incl. Tracing, Replay) 69.29 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 74.48 KB (0%)
CDN Bundle - uncompressed 68.97 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 103.98 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 214.38 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 227.09 KB (0%)
@sentry/nextjs (client) 36.35 KB (0%)
@sentry/sveltekit (client) 34.07 KB (0%)
@sentry/node 130.84 KB (-0.01% 🔽)
@sentry/node - without tracing 91.86 KB (0%)
@sentry/aws-serverless 117.03 KB (-0.01% 🔽)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Luca Forstner
logic
84d9bd7
@lforst
lforst force-pushed the lforst-otel-for-nextjs branch from 8c2fe86 to 84d9bd7 Compare July 4, 2024 13:42
Luca Forstner
Merge branch 'develop' into lforst-otel-for-nextjs
403b28e
Luca Forstner added 4 commits July 5, 2024 08:07
Luca Forstner
drop ingest spans
542bcda
Luca Forstner
span quality
19260d6
Luca Forstner
Merge branch 'develop' into lforst-otel-for-nextjs
c5bd534
Luca Forstner
Add test
88f9a54
@lforst

lforst commented Jul 5, 2024

Copy link
Copy Markdown
Contributor Author

@mydea @chargome This grew pretty big in changes ever since you reviewed last. Feel free to give this another pass so I don't merge any crap.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lforst
lforst requested review from chargome and mydea July 5, 2024 10:37
mydea
mydea reviewed Jul 5, 2024
View reviewed changes
Comment thread dev-packages/e2e-tests/test-applications/nextjs-14/playwright.config.ts
},
{
// This comes with the risk of tests leaking into each other but the tests run quite slow so we should parallelize
workers: '100%',

@mydea mydea Jul 5, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🤞

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lforst lforst Jul 5, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

my thought was: If the tests leak, the tests are bad anyways.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mydea mydea Jul 5, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mydea
mydea reviewed Jul 5, 2024
View reviewed changes
Comment thread packages/nextjs/src/server/index.ts Outdated
}
});

client?.on('spanEnd');

@mydea mydea Jul 5, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Suggested change
client?.on('spanEnd');

I guess this is a leftover? 😅

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mydea
mydea reviewed Jul 5, 2024
View reviewed changes
Comment thread packages/nextjs/src/server/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

mydea
mydea approved these changes Jul 5, 2024
View reviewed changes

@mydea mydea left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM! 🚀

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
chargome
chargome reviewed Jul 5, 2024
View reviewed changes
Comment thread packages/nextjs/src/server/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

chargome
chargome approved these changes Jul 5, 2024
View reviewed changes
Luca Forstner added 2 commits July 8, 2024 07:53
Luca Forstner
Merge remote-tracking branch 'origin/develop' into lforst-otel-for-ne…
2ecb806
…xtjs
Luca Forstner
Review feedback
df0c49e
@lforst lforst changed the title feat(nextjs): Use Next.js generated serverside spans for app router rendering feat(nextjs): Use spans generated by Next.js for App Router Jul 8, 2024
Luca Forstner added 2 commits July 8, 2024 09:42
Luca Forstner
Add changelog entry
ceb9d2c
Luca Forstner
Merge branch 'develop' into lforst-otel-for-nextjs
690a07d
@lforst
lforst merged commit 4c54a79 into develop Jul 8, 2024
@lforst
lforst deleted the lforst-otel-for-nextjs branch July 8, 2024 12:25
This was referenced Jul 30, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.16.0 https-quantumblockchainai-atlassian-net/ossinsight#787
Open
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.17.0 https-quantumblockchainai-atlassian-net/ossinsight#791
Open
@amykapernick amykapernick mentioned this pull request Aug 1, 2024
[Snyk] Upgrade @sentry/nextjs from 8.14.0 to 8.17.0 amykapernick/wedding#12
Open
@wkylin wkylin mentioned this pull request Aug 1, 2024
[Snyk] Upgrade @sentry/react from 8.15.0 to 8.17.0 wkylin/pro-react-admin#370
Closed
@q1blue q1blue mentioned this pull request Aug 6, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.18.0 https-quantumblockchainai-atlassian-net/ossinsight#799
Open
@wkylin wkylin mentioned this pull request Aug 7, 2024
[Snyk] Upgrade @sentry/react from 8.15.0 to 8.18.0 wkylin/pro-react-admin#371
Merged
This was referenced Aug 9, 2024
[Snyk] Upgrade @sentry/react from 7.118.0 to 8.19.0 Stanislav1975/win11React#4
Open
[Snyk] Upgrade @sentry/node from 6.17.4 to 8.19.0 Stanislav1975/shields#596
Open
@q1blue q1blue mentioned this pull request Aug 9, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.19.0 https-quantumblockchainai-atlassian-net/ossinsight#802
Open
@FengShangWuQi FengShangWuQi mentioned this pull request Aug 11, 2024
[Snyk] Upgrade @sentry/gatsby from 7.20.0 to 8.19.0 FengShangWuQi/fengshangwuqi.github.io#1914
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mydea mydea mydea approved these changes
@chargome chargome chargome approved these changes
@AbhiPrasad AbhiPrasad Awaiting requested review from AbhiPrasad
@andreiborza andreiborza Awaiting requested review from andreiborza

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@lforst @mydea @chargome
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.