GoogleCloudPlatform / opentelemetry-operations-js

This repository is home to Google Cloud Exporters (Trace and Monitoring) for OpenTelemetry Node.js Project (https://github.com/open-telemetry/opentelemetry-js)
Apache License 2.0
67 stars 63 forks source link

Spans not connecting properly to root or not visible at all in Trace dashboard #337

Closed TriPSs closed 3 years ago

TriPSs commented 3 years ago

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

    "@opentelemetry/api": "^1.0.3",
    "@opentelemetry/instrumentation-dns": "^0.25.0",
    "@opentelemetry/instrumentation-graphql": "^0.25.0",
    "@opentelemetry/instrumentation-http": "^0.25.0",
    "@opentelemetry/instrumentation-mysql": "^0.25.0",
    "@opentelemetry/instrumentation-nestjs-core": "^0.25.0",
    "@opentelemetry/resource-detector-gcp": "^0.25.0",
    "@opentelemetry/sdk-trace-base": "^1.0.0",
    "@opentelemetry/sdk-trace-node": "^1.0.0",
    "@opentelemetry/tracing": "^0.24.0",

What version of Node are you using?

v14.15.1

What did you do?

I enabled tracing in my API that is running on Cloud Run, with the following instructrions

registerInstrumentations({
    instrumentations: [
      new DnsInstrumentation(),
      new MySQLInstrumentation(),
      new NestInstrumentation(),
      new HttpInstrumentation(),
      new GraphQLInstrumentation({
        mergeItems: true
      })
    ]
  })

Only the Fastify requests are visible inside the correct root span but all the mysql spans are not connected to the root span, grapql spans are completely missing in google trace.

What did you expect to see?

To see all the spans connected to the trace like this: image

As you can see in the image, if I use Jaegur as exporter everything works as expected.

What did you see instead?

image

Additional context

Add any other context about the problem here.

TriPSs commented 3 years ago

After downgrading everything to the same version as opentelemetry-cloud-trace-exporter it worked.

aabmass commented 3 years ago

FYI @opentelemetry/tracing was renamed to @opentelemetry/sdk-trace-base so you shouldn't have the former at all anymore.

NPM should be complaining that the peer dependencies of @google-cloud/opentelemetry-cloud-trace-exporter are not met if the versions are mismatched. Not sure why you weren't getting that. Regardless, with the OTel 1.0 release just made, this should be a problem of the past once I release the Google packages for the new version