Skip to content

feat(tracing): add Next.js-compatible request root spans - #3264

Draft
james-elicx wants to merge 3 commits into
codex/otel-02b-workers-tracingfrom
codex/otel-03-request-root
Draft

james-elicx wants to merge 3 commits into
codex/otel-02b-workers-tracingfrom
codex/otel-03-request-root

Conversation

@james-elicx

@james-elicx james-elicx commented Sep 14, 2026

Copy link
Copy Markdown
Member

Summary

  • emit one BaseServer.handleRequest framework root across App/Pages and Node/Workers
  • preserve incoming propagation, parameterized route identity, RSC/status/error attributes, and outer platform route correlation
  • keep instrumentation and Worker ExecutionContext active for the full request lifecycle without requiring OpenTelemetry packages
  • preserve cacheability probe/admission scoping while tracing multi-stage Pages requests
  • validate real @sentry/nextjs transactions, child spans, propagation, isolation, and failures for both routers

Validation

  • vp check
  • vp run vinext#build
  • pnpm knip (existing apps/web/dist/** hint only)
  • focused tracing/instrumentation/Worker tests: 83 passed
  • multi-stage Pages cacheability probe E2E: 2 passed
  • App Sentry E2E: 6 passed
  • Pages Sentry E2E: 6 passed
  • independent correctness review: no findings
  • independent Next.js parity review: no findings

Stack

Depends on #3261.

@james-elicx
james-elicx added this pull request to stack #3258 September 14, 2026 22:16
@james-elicx james-elicx changed the title codex/otel 03 request root feat(tracing): add Next.js-compatible request root spans Sep 14, 2026
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please report any actionable findings within the eight-minute review time limit. Focus on request-root lifecycle correctness, Next.js OpenTelemetry parity, Node/Workers parity, provider/ExecutionContext propagation, and whether any OpenTelemetry package became required.

@pkg-pr-new

pkg-pr-new Bot commented Sep 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

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

create-vinext-app

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

@vinext/types

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

vinext

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

@cloudflare/workers-response-store

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

commit: 5285d0c

@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

@james-elicx
james-elicx force-pushed the codex/otel-03-request-root branch from 2b070bd to b54a8b7 Compare September 14, 2026 22:21
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

The head changed to b54a8b7 after fixing the cacheability-probe scope regression found by CI. Please review this exact head and report actionable findings within the eight-minute time limit. Focus on request-root lifecycle correctness, Next.js OTel parity, Node/Workers parity, ExecutionContext and cacheability-state isolation, and dependency boundaries.

Comment thread packages/vinext/src/server/workers-tracing.ts Outdated
Comment thread packages/vinext/src/server/app-rsc-handler.ts
@ask-bonk

ask-bonk Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

To https://github.com/cloudflare/vinext.git
! [rejected] codex/otel-03-request-root -> codex/otel-03-request-root (fetch first)
error: failed to push some refs to 'https://github.com/cloudflare/vinext.git'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

github run

@ask-bonk

ask-bonk Bot commented Sep 14, 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

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 5285d0c against base ec2e0f1 using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 1 regressed · 5 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.2 KB 142.3 KB ⚫ +0.0%
Client entry size (gzip) vinext 129.6 KB 129.6 KB ⚫ +0.0%
Dev server cold start vinext 3.46 s 3.49 s ⚫ +1.1%
Production build time vinext 3.74 s 3.72 s ⚫ -0.5%
RSC entry closure size (gzip) vinext 121.0 KB 122.9 KB 🔴 +1.5%
Server bundle size (gzip) vinext 211.0 KB 212.9 KB ⚫ +0.9%

View detailed results and traces

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

@james-elicx
james-elicx force-pushed the codex/otel-03-request-root branch from b54a8b7 to 991ca4c Compare September 14, 2026 22:48
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please review exact head 991ca4c and report any actionable findings within your 8-minute time limit.

@james-elicx
james-elicx force-pushed the codex/otel-03-request-root branch from 991ca4c to 3069dec Compare September 14, 2026 22:53
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please review exact head 3069dec and report actionable findings within your 8-minute time limit. Focus on request-root lifecycle correctness, Next.js OTel parity, Node/Workers parity, internal trace-header trust/stripping, and the optional OpenTelemetry dependency boundary.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Exact head is 3069dec. The prior run was cancelled by the head update. Please finish this review and report actionable findings within the 8-minute time limit.

Comment thread packages/vinext/src/server/pages-request-stage-entry.ts Outdated
Comment thread packages/vinext/src/server/request-tracing.ts
Comment thread packages/vinext/src/index.ts
Comment thread packages/vinext/src/server/prod-server.ts Outdated
Comment thread packages/vinext/src/server/prod-server.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

To https://github.com/cloudflare/vinext.git
! [rejected] codex/otel-03-request-root -> codex/otel-03-request-root (fetch first)
error: failed to push some refs to 'https://github.com/cloudflare/vinext.git'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please start a fresh review of exact head 3069dec now that the stale 991ca4c run has terminated. Report actionable findings within your 8-minute time limit; do not modify or push the branch.

Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>
@ask-bonk

ask-bonk Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

No additional findings. The five existing inline findings still apply to exact head 3069dec956494bbfcfe1a4609a475cdafe591d8e.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please review exact head 86166d8 without modifying or pushing the branch. Report all actionable findings within your 8-minute time limit. Focus on the five prior findings, request-root lifecycle correctness, Next.js OTel parity, Node/Workers parity, Vite-environment registration deduplication, and optional dependency boundaries.

@ask-bonk

ask-bonk Bot commented Sep 14, 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

@james-elicx
james-elicx force-pushed the codex/otel-03-request-root branch from 86166d8 to b4ded49 Compare September 14, 2026 23:07
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please review exact head b4ded49 without modifying or pushing the branch. Report all actionable findings within your 8-minute time limit. Confirm the prior five findings are resolved and focus especially on the corrected single-stage versus multi-stage Pages cacheability-context boundary, request-root lifecycle, Next.js OTel parity, Node/Workers parity, and optional dependency boundaries.

@ask-bonk

ask-bonk Bot commented Sep 14, 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

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