-
Notifications
You must be signed in to change notification settings - Fork 821
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
Cannot get HTTP Context Propagation to work #4247
Comments
This issue comes from a thread in CNCF's slack In that conversation it was pointed out that the sample project uses ESM imports (kudos to @RichiCoder1) and there are some PRs for handling it on specific packages We should probably check this 1st. |
I believe |
There is no additional/different hook needed. Just use the hook from |
@Flarna do you think we should add a note in the automatic instrumentation docs? |
Not sure. |
@Flarna it looks like the context isn't being propagated still after adding the |
That's not correct, no? It's true that
Though I'm sure there's caveats with that. |
As of now the ESM hooks needs to be specify additionally to the register hook to initialize the SDK. Anyhow, maybe someone with more ESM experience can attach a debugger to take a look what exactly is not working in this sample if both hooks are specified. |
Fetch instrumentation (which is used to call between Dice Roller & Randomizer services) is not part of https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node Switching to use plain |
Ah, good find. A possible point of confusion is that there are a number of
The latter two, I believe, can be instrumented by the 3rd party https://github.com/gadget-inc/opentelemetry-instrumentations/tree/main/packages/opentelemetry-instrumentation-undici package. I don't know about node-fetch instrumentation. I haven't looked what it is using for HTTP client communication. |
As far as I know There is open-telemetry/opentelemetry-js-contrib#1021 which has some more references. |
I was wrong. So that means it would need instrumentation for that fetch. There are these two 3rd-party instrumentations which theoretically should work, but I haven't used them:
|
@tglanz See the previous comment. IIUC, your code is using Node.js's core The set of instrumentations included with |
ofc, will try that soon @trentm |
Switched to node's
According to your suggestion, I tried to instrument
|
That fetch instrumentation is targeted for web platform instead of node since it has There is this discussion with a custom instrumentation for fetch that may help you get the tracing working I wonder if this should create a instrumentation for fetch in this repo. As a customer I'd like to have Node APIs like fetch instrumented 🤔 |
Since this is not a bug but a missing instrumentation I've created a new feature request to add a I guess we can close this one and continue the conversation there cc @pichlermarc |
thanks, closing |
What happened?
Hi, I have set up OTEL tracing but can't get context propagation to work.
In my setup I have a web app that interacts with an express service that calls another express service. The services export traces to using Grpc a local Collector and are then exported to Jaeger. I can see the spans are exported fine, contain information from the http and express instrumentation libraries but context hasn't been propagated - The relevant spans don't have a parent and the relevant HTTP requests don't contain the HTTP Headers that are needed.
The example project is here: https://github.com/tglanz/simple-tracing. The components are:
The OTEL is being set up automatically by running node with some relevant OTEL env vars and specifically
NODE_OPTIONS="--require @opentelemetry/auto-instrumentations-node/register"
.Note that I also tried initializing OTEL manually with the same results.
In the example repository, running
docker compose up
will deploy the Web App at http://localhost:5173, the Die Roller at http://localhost:8000, the Randomizer service, a Collector with an OTLP Grpc receiver at http://localhost:4173 and a Jaeger FE at http://localhost:16686.The collector logs (attached) don't show any error that looks relevant.
Is there any issue here or do I miss something basic?
Thanks!
OpenTelemetry Setup Code
Run the first service using node with the env variables below
Run the second service using similar env vars but only the service name is changed.
package.json
Relevant log output
The collector log was to big for putting in the issue and can be found here: https://raw.githubusercontent.com/tglanz/simple-tracing/main/service/collector.log
The text was updated successfully, but these errors were encountered: