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

Mongodb integration doesn't work when used with promises #2218

Closed
richardsimko opened this issue May 17, 2024 · 4 comments
Closed

Mongodb integration doesn't work when used with promises #2218

richardsimko opened this issue May 17, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@richardsimko
Copy link

What version of OpenTelemetry are you using?

0.39.0

What version of Node are you using?

20.12

What did you do?

Running the OpenTelemetry Mongodb integration provided through Sentry v8.

What did you expect to see?

Traces for Mongo DB requests when making queries using promises

What did you see instead?

No traces

Additional context

From my understanding the patch of the server command function only applies the span if there is a callback provided (https:/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts#L443-L447). When using the mongo library with promises no callback is provided (https:/mongodb/node-mongodb-native/blob/main/src/sdam/server.ts#L326) and as a result no spans are created.

I couldn't find anything in the docs saying that promises aren't supported, so perhaps there is something I'm missing?

@AbhiPrasad
Copy link
Member

Does this apply for all versions of mongodb?

@richardsimko
Copy link
Author

I'm not sure, we're running [email protected]

@mydea
Copy link
Contributor

mydea commented May 23, 2024

Could you share a concrete code snippet of something that is not instrumented today? (Just to clarify and make it easier to test this)

@richardsimko
Copy link
Author

I think it was incorrect of me to assume this was the issue as it seems to have been resolved downstream in Sentry. See getsentry/sentry-javascript#12181 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants