opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

HTTP example issues - no custom spans

Open lomboboo opened this issue 4 years ago • 4 comments

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

server.js

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:

  1. Cannot read property 'context' of undefined on line examples/http/server.js:25
  2. After commenting console.log(`traceid: ${currentSpan.context().traceId}`); that throws an error, I can see some tracing info, but no custom SPANs image image

lomboboo avatar Apr 12 '21 10:04 lomboboo

Looks like this issue appears only when using api 1.0.0-rc.0

lomboboo avatar Apr 12 '21 11:04 lomboboo

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.

dyladan avatar Apr 12 '21 19:04 dyladan

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"

lomboboo avatar Apr 12 '21 21:04 lomboboo

The example needs to be updated but I think the current example doesn't have this issue.

dyladan avatar Jul 13 '22 16:07 dyladan

Closing as the current sample on main works fine. :slightly_smiling_face:

pichlermarc avatar Jun 12 '23 15:06 pichlermarc