Replies: 1 comment 1 reply
-
It might be better to keep outbound instrumentation outside of Next. This is a path we took for |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
The Next.js OpenTelemetry instrumentation should be decisive about trace propagation since the current implementation makes it difficult to use OpenTelemetry instrumentation.
Background
Currently, Next.js propagates OpenTelemetry trace data for incoming requests, but not for outgoing requests. This makes Next.js very tricky to use with existing official OpenTelemetry instrumentation (like the OTEL http instrumentation) which generally instruments both, incoming, and outgoing requests. To be able to use the OTEL instrumentation, you need to either, very expensivley, stomp all spans created by Next.js, or weirdly override the OpenTelemetry instrumentation.
Since it is very common to use the OpenTelemetry HTTP instrumentation, Next.js is probably doing more harm in this situation than good.
Proposal
My proposed solution for this is pretty straightforward:
clientTraceMetadata
experimental option to propagate tracing data to the client #64256)That way, people can, without any complications, implement their own propagation instrumentation logic, without Next.js interfering.
An alternative solution would be for Next.js to instrument and propagate everything (incoming reqs, outgoing http reqs, outgoing fetch reqs, client propagation), but then Next.js has to make guarantees about it.
Beta Was this translation helpful? Give feedback.
All reactions