opentelemetry-js
opentelemetry-js copied to clipboard
HTTP example issues - no custom spans
Please answer these questions before submitting a bug report.
What version of OpenTelemetry are you using?
Dependencies from the http example of this repo
"@opentelemetry/api": "^1.0.0-rc.0",
"@opentelemetry/exporter-jaeger": "^0.18.2",
"@opentelemetry/exporter-zipkin": "^0.18.2",
"@opentelemetry/instrumentation": "^0.18.2",
"@opentelemetry/instrumentation-http": "^0.18.2",
"@opentelemetry/node": "^0.18.2",
"@opentelemetry/tracing": "^0.18.2"
What version of Node are you using?
v14.15.4
Please provide the code you used to setup the OpenTelemetry SDK
What did you do?
Jaeger UI dashboard running on http://localhost:16686
npm install from the folder
npm run jaeger:server
npm run jaeger:client
What did you expect to see?
Expected to see makeRequest, handleRequest custom spans as per screenshot from the example
What did you see instead?
There are two issues that I can see:
Cannot read property 'context' of undefinedon lineexamples/http/server.js:25- After commenting
console.log(`traceid: ${currentSpan.context().traceId}`);that throws an error, I can see some tracing info, but no custom SPANs

Looks like this issue appears only when using api 1.0.0-rc.0
https://www.npmjs.com/package/@opentelemetry/instrumentation-http depends on version 0.18.1 of the API. https://github.com/open-telemetry/opentelemetry-js/blob/v0.18.2/packages/opentelemetry-instrumentation-http/package.json#L72
A version of core has not been released which is using the API RC. I will start working on a release PR for that now.
Understood, looking forward to try it out. Then, for the future seekers for the answer , I've ended up using those versions:
"@opentelemetry/api": "^0.18.1",
"@opentelemetry/exporter-jaeger": "^0.18.2",
"@opentelemetry/exporter-zipkin": "^0.18.2",
"@opentelemetry/instrumentation": "^0.18.2",
"@opentelemetry/instrumentation-http": "^0.18.2",
"@opentelemetry/node": "^0.18.2",
"@opentelemetry/tracing": "^0.18.2"
The example needs to be updated but I think the current example doesn't have this issue.
Closing as the current sample on main works fine. :slightly_smiling_face: