-
Notifications
You must be signed in to change notification settings - Fork 820
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
Context Propagation doesn't work with NestJS & fetch #4470
Comments
We currently don't have a node-based fetch instrumentation, so that's why there's no propagation. |
oki good to know! I would be eager to contribute :) |
for reference: |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
Closing this as the new undici instrumentation is now available: https://www.npmjs.com/package/@opentelemetry/instrumentation-undici node-fetch uses |
What happened?
Tracing with NestJS seems to work nicely for each micro-service. But when trying to propagate a trace ID to trace several micro-services communicating between each other, the propagation seems not to be working as the traceID from the micro-service A is nowhere to be found in micro-service B.
To reproduce, I crafted a simple example repository.
Steps to Reproduce
I created a simple NestJS application with tracing in
tracing.ts
. When querying GET/hello
, the hello endpoint sends a request to/world
, and return the result from theworld
endpoint.Repository: https://github.com/Lp-Francois/bug-report-otel-nestjs
To run it follow the next step:
In 1 terminal, run the following commands.
in another terminal, or from postman/other fetch this endpoint:
http://localhost:3002/hello
, and notice 2 things:fetch
API #4333 & Cannot get HTTP Context Propagation to work #4247)Example: run
curl -v http://localhost:3002/hello
Expected Result
I would expect the traceID to be propagated to my endpoints:
According to https://www.w3.org/TR/trace-context/ I was expecting at least a
traceparent
header.Expected steps:
When I pass a traceparent in the headers of my GET request to
/hello
traceparent
header is use it for the current request ✅Actual Result
In the postman/curl response (
curl -v http://localhost:3002/hello
) I don't have trace info.And in the 2nd request the traceID from the
/hello
is not usedAdditional Details
OpenTelemetry Setup Code
package.json
Relevant log output
The text was updated successfully, but these errors were encountered: