Skip to content
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

getSpanLImits method missing in Tracer class #4313

Closed
sajitron opened this issue May 16, 2024 · 5 comments
Closed

getSpanLImits method missing in Tracer class #4313

sajitron opened this issue May 16, 2024 · 5 comments

Comments

@sajitron
Copy link

dd-trace Tracer class doesn't implement the getSpanLimits method which is present in the opentelemetry Tracer class.

This breaks prisma instrumentation for @prisma/instrumentation: >4.13.0 with the following error:

uncaughtException: parentTracer.getSpanLimits is not a function
TypeError: parentTracer.getSpanLimits is not a function
    at new Span (/usr/src/app/node_modules/@opentelemetry/sdk-trace-base/build/src/Span.js:59:41)
    at /usr/src/app/node_modules/@prisma/instrumentation/dist/chunk-VVAFFO6L.js:59:20
    at Array.forEach (<anonymous>)
    at ActiveTracingHelper.createEngineSpan (/usr/src/app/node_modules/@prisma/instrumentation/dist/chunk-VVAFFO6L.js:44:27)
    at eo.createEngineSpan (/usr/src/app/node_modules/@prisma/client/runtime/library.js:122:1645)
    at wt.logger (/usr/src/app/node_modules/@prisma/client/runtime/library.js:112:1167)
    at /usr/src/app/node_modules/@prisma/client/runtime/library.js:112:922
@jerry-f
Copy link

jerry-f commented Jul 22, 2024

Please tell me how you solved it. I'm having the same problem.

@sajitron
Copy link
Author

Please tell me how you solved it. I'm having the same problem.

You need to do a patch of the library.

Add the following method to the Tracer class within the file - node_modules/dd-trace/packages/dd-trace/src/opentelemetry/tracer.js:

getSpanLimits () {
   return {}
}

@VicenteRD
Copy link

Hello! Version 5.19.0 applied this patch, which according to @sajitron should fix this issue, but I tried it and it didn't do it. I don't understand how patching that version of the Tracer class would fix the issue since the tracer that is passed to Prisma is the one at the base of the package, isn't it?
Am I doing something wrong here? Can someone share their setup working with version 5.19.0?
Thanks!

@VicenteRD
Copy link

VicenteRD commented Jul 29, 2024

I've figured it out. Turns out, when calling register on a TracerProvider, it can fail to register the provider as the global one if there's a version mismatch for the OpenTelemetry API package, so you need to make sure that, if you're importing the API yourself, you do so with the same version the dd-trace package does. In this case, 1.8.0, with 1.9.0 being the latest.

TL;DR: Make sure that if you have @opentelemetry/api in your package.json, it's set to whatever version dd-trace depends on (for 5.19.0, API version is 1.8.0).

EDIT: Maybe the register method in node_modules/dd-trace/packages/dd-trace/src/opentelemetry/tracer_provider.js should expose this issue if it happens, either by returning a boolean or logging a warning message...

@sajitron
Copy link
Author

Seems the bug has been fixed in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants