Skip to content

feat(tracing): add App segment module spans - #3270

Draft
james-elicx wants to merge 1 commit into
codex/otel-05c-metadata-spansfrom
codex/otel-05d-segment-module-spans
Draft

james-elicx wants to merge 1 commit into
codex/otel-05c-metadata-spansfrom
codex/otel-05d-segment-module-spans

Conversation

@james-elicx

Copy link
Copy Markdown
Member

Summary

  • emit the stable NextNodeServer.createComponentTree and NextNodeServer.getLayoutOrPageModule hierarchy through the shared framework tracer
  • trace only selected App Router page/layout modules, including named and sibling interception branches, while keeping default-only and inactive slots hidden
  • preserve exact Next.js segment identities for __PAGE__, route groups/dynamic segments, and named slot roots ((__SLOT__))
  • prove the hierarchy with the unchanged real @sentry/nextjs integration on Workerd

Next.js parity

Pinned against vercel/next.js@b421cadefd31c1b59d117842021ded7c1ebaf5b4, especially:

  • packages/next/src/server/app-render/create-component-tree.tsx
  • packages/next/src/server/lib/app-dir-module.ts
  • packages/next/src/server/lib/trace/constants.ts
  • test/e2e/opentelemetry/instrumentation/opentelemetry.test.ts

Present page/layout modules emit even when their default export is invalid, while defaultPage remains hidden exactly as in Next.js. Eagerly hydrated inactive slot modules do not create spans.

No OpenTelemetry package is added as a required vinext dependency, and no Sentry-specific runtime path is introduced. The same descriptors flow to Workers tracing automatically.

Validation

  • vp check
  • focused App tracing/tree/wiring/framework/Workers suites (173 passed)
  • vp run vinext#build
  • PLAYWRIGHT_PROJECT=cloudflare-sentry-app pnpm run test:e2e (17 passed)
  • independent correctness review: clean after addressing default-only slots and sibling-interception paths
  • independent Next.js parity review: clean after adding the component-tree parent, exact named-slot identity, module-presence behavior, and missing-default ancestor spans

Stack parent: #3269

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues. You have an 8-minute time limit; report all findings within that limit.

@pkg-pr-new

pkg-pr-new Bot commented Sep 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/cloudflare/vinext/@vinext/cloudflare@3270

create-vinext-app

npm i https://pkg.pr.new/cloudflare/vinext/create-vinext-app@3270

@vinext/types

npm i https://pkg.pr.new/cloudflare/vinext/@vinext/types@3270

vinext

npm i https://pkg.pr.new/cloudflare/vinext@3270

@cloudflare/workers-response-store

npm i https://pkg.pr.new/cloudflare/vinext/@cloudflare/workers-response-store@3270

commit: 09ffc24

@ask-bonk

ask-bonk Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

error: Your local changes to the following files would be overwritten by checkout:
AGENTS.md
Please commit your changes or stash them before you switch branches.
Aborting

github run

@ask-bonk

ask-bonk Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

@james-elicx Bonk workflow failed. Check the logs for details.

View workflow run · To retry, trigger Bonk again.

@github-actions

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
response-store-demo preview production
static-export preview production
web preview production

@github-actions

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 09ffc24 against base 098e10a using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.3 KB 142.3 KB ⚫ +0.0%
Client entry size (gzip) vinext 129.7 KB 129.7 KB ⚫ +0.0%
Dev server cold start vinext 3.42 s 3.38 s ⚫ -1.2%
Production build time vinext 3.94 s 3.93 s ⚫ -0.2%
RSC entry closure size (gzip) vinext 125.0 KB 125.3 KB ⚫ +0.3%
Server bundle size (gzip) vinext 215.6 KB 215.9 KB ⚫ +0.1%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant