-
Notifications
You must be signed in to change notification settings - Fork 30.3k
feat(tracing): add OpenTelemetry spans to prerenderToStream phases #88914
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
base: canary
Are you sure you want to change the base?
Conversation
Add tracing spans to visualize the different phases of the Cache Components prerender pipeline in prerenderToStream: - Initial RSC Payload generation - Initial Server Prerender (prospective render to fill caches) - Cache Ready Wait (waiting for all cache reads to complete) - Initial Client Prerender (HTML prerender to fill client caches) - Final RSC Payload generation (with warmed caches) - Final Server Prerender (final RSC render with task-based abort) - Final Client Prerender (final HTML render with task-based abort) These spans help developers understand the performance characteristics of their Cache Components-enabled applications during build time.
e1b0e42 to
53e7e26
Compare
Stats from current PR🔴 1 regression
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **432 kB** → **432 kB** ✅ -58 B82 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (16 files)Files with changes:
View diffsapp-page-exp..ntime.dev.jsDiff too large to display app-page-exp..time.prod.jsDiff too large to display app-page-tur..ntime.dev.jsDiff too large to display app-page-tur..time.prod.jsDiff too large to display app-page-tur..ntime.dev.jsDiff too large to display app-page-tur..time.prod.jsDiff too large to display app-page.runtime.dev.jsDiff too large to display app-page.runtime.prod.jsDiff too large to display app-route-ex..ntime.dev.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route.runtime.dev.jsDiff too large to display pages-api-tu..ntime.dev.jsDiff too large to display pages-api.runtime.dev.jsDiff too large to display pages-turbo...ntime.dev.jsDiff too large to display pages.runtime.dev.jsDiff too large to display |
- Add span for generateDynamicFlightRenderResult - Add runtime prerender spans for prefetch scenarios - Improve span naming consistency (prospective/final pattern)
Failing test suitesCommit: edd96f3 | About building and testing Next.js
Expand output● runtime prefetching › in a private cache › can completely prefetch a page that uses cookies and no uncached IO ● runtime prefetching › in a private cache › can completely prefetch a page that uses cookies and no uncached IO |
What?
Adds comprehensive OpenTelemetry tracing spans to the App Router render pipeline, covering both build-time prerendering and runtime prefetch scenarios.
Why?
When debugging or optimizing applications, it's helpful to understand where time is being spent during rendering. These spans provide visibility into:
Build-time (Cache Components prerender):
Runtime (prefetch):
Dynamic Flight Rendering:
generateDynamicFlightRenderResultspan for RSC streaming responsesHow?
AppRenderSpan.generateDynamicFlightRenderResultfor dynamic flight result generationPrerenderSpanenum for prefetch scenariosprospective/finalterminologygetTracer().trace()callsNote: To expose these spans with OpenTelemetry traces, set the
NEXT_OTEL_VERBOSE=1environment variable.