Opentelemetry - Spans for static resources and API pages not part of page load trace #65989
Labels
bug
Issue was opened via the bug report template.
Instrumentation
Related to Next.js Instrumentation.
Link to the code that reproduces this issue
https://github.com/bradleyberwick/reproduction-otel
To Reproduce
Current vs. Expected behavior
Current behaviour:
When I do a full page load in my app (I've added my OTEL config in the repo app), spans are created for the page (e.g. GET /), for static resources (e.g. _next/static/chunks/...js , _next/static/{id}/_buildManifest.js, etc) and API pages (e.g. /api/geoip, etc). Currently these spans are separate and part of different trace ID's.
Expected behaviour:
Ideally, I want these spans to be part of the same trace as they're loaded as part of the same page load. I don't think this is possible because the other resources (i.e. static resources and API pages) are pre-built on the server-side and they don't know the trace ID at this point. The calls to these other resources are then made from the client and not via the initial page load request and therefore the context is not propagated.
Can I have some further clarification on this please?
Provide environment information
Which area(s) are affected? (Select all that apply)
Instrumentation
Which stage(s) are affected? (Select all that apply)
next start (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: