feat(tracing): add OpenTelemetry spans to prerenderToStream phases#88914
Open
feat(tracing): add OpenTelemetry spans to prerenderToStream phases#88914
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
Collaborator
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** ✅ -32 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 (22 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-ex..time.prod.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route-tu..time.prod.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route-tu..time.prod.jsDiff too large to display app-route.runtime.dev.jsDiff too large to display app-route.ru..time.prod.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-turbo...time.prod.jsDiff too large to display pages.runtime.dev.jsDiff too large to display pages.runtime.prod.jsDiff too large to display |
- Add span for generateDynamicFlightRenderResult - Add runtime prerender spans for prefetch scenarios - Improve span naming consistency (prospective/final pattern)
Collaborator
Tests Passed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.