Skip to content
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

Opentelemetry - Spans for static resources and API pages not part of page load trace #65989

Open
bradleyberwick opened this issue May 20, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. Instrumentation Related to Next.js Instrumentation.

Comments

@bradleyberwick
Copy link

Link to the code that reproduces this issue

https://github.com/bradleyberwick/reproduction-otel

To Reproduce

  1. Yarn build
  2. Yarn start
  3. View traces in local Grafana

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

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Enterprise
Binaries:
  Node: 20.11.1
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.0.4
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

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

@bradleyberwick bradleyberwick added the bug Issue was opened via the bug report template. label May 20, 2024
@github-actions github-actions bot added the Instrumentation Related to Next.js Instrumentation. label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Instrumentation Related to Next.js Instrumentation.
Projects
None yet
Development

No branches or pull requests

1 participant