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

[JS] Tracing missing "root" span for nextjs #434

Open
i2amsam opened this issue Jun 20, 2024 · 0 comments
Open

[JS] Tracing missing "root" span for nextjs #434

i2amsam opened this issue Jun 20, 2024 · 0 comments
Assignees
Labels
bug Something isn't working js

Comments

@i2amsam
Copy link
Contributor

i2amsam commented Jun 20, 2024

Describe the bug
When prod traces are logged with autoInstrumentation=true some traces fail to be shown in the DevUI. The proximate cause is that traces are logged without a startTime attribute on the span. You will also see spans in GCP with "Missing span ID" errors. The start/end dates are missing for the same reason. We determined that turning off autoinstrumentation restores startTime, because the root span will be provided by Genkit in that case.

Upon further investigation, this appears to be attributed to Nextjs specific behavior. Sentry also encountered this issue: getsentry/sentry-javascript#11046. Most likely Nextjs specific implementation details are required to resolve. Nextjs provides a "hook" (instrumentation.ts) for initializing OTel. See also: https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation.

To Reproduce
Steps to reproduce the behavior. Code samples.

Expected behavior
All prod traces in the remote tracestore should be viewable in the DevUI

Screenshots
Here's an example trace in Firestore without startTime

image

And in cloud trace (missing root span)
image

Runtime (please complete the following information):
NextJS app deployed to Firebase App Hosting

@i2amsam i2amsam added bug Something isn't working js labels Jun 20, 2024
@MichaelDoyle MichaelDoyle changed the title [JS] Bug in logged tracestore traces when using autoInstrumentation [JS] Missing "root" span for nextjs Jun 26, 2024
@MichaelDoyle MichaelDoyle changed the title [JS] Missing "root" span for nextjs [JS] Tracing missing "root" span for nextjs Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working js
Projects
None yet
Development

No branches or pull requests

4 participants