-
Notifications
You must be signed in to change notification settings - Fork 3
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
Using with express async-await controller creates unlinked spans #29
Comments
Hi @nirsky, I think that is related to #16 i found the same problem in other projects open-telemetry/opentelemetry-js#940 and a the base pr is this one: open-telemetry/opentelemetry-js#926 Other interesting issues: open-telemetry/opentelemetry-js#752 I keep digging in this and i will report on this and #16 |
I have added a test case to cover this issue in #30 |
Thanks for your quick reply! Is #30 containing a fix or only tests? (I guess only tests so far by looking at the code). |
sadly only test cases to cover your issue. i am following this PR open-telemetry/opentelemetry-js#926 that should resolve this issue. i suspect that every open telemetry implementation actually suffer this problem in JS... I have reported the same for mysql... |
Even if open-telemetry/opentelemetry-js#926 resolves some bugs, i'm pretty sure it will not fixes this one because |
@vmarchaud oh thank you for your feedback i digging more in the mongoose method list and try to prepare a big patch... |
yep, @vmarchaud is totally right the problem is strictly related to "thenables", in the test case: Promise.all([
User
.find({id: "_test"})
.skip(1)
.limit(2)
.sort({email: 'asc'}),
User.countDocuments()
]) if i force a true promise with Promise.all([
User
.find({id: "_test"})
.skip(1)
.limit(2)
.sort({email: 'asc'}).exec(),
User.countDocuments().exec()
]) everything is correctly linked together. Same with your use case with This is not simple and i actually i don't understand how to change the mongoose flow in true promises and keeping the project workflow unchanged... |
This should be fixed by #34 |
Hey! First thing, thanks for taking the time and effort for creating this plugin.
I noticed using async-await on the query does not link the mongoose span with the express span unless the query is executed with
exec()
.Here are some example:
Using then() - Links correctly
Using async-await with exec - Links correctly
Using async-await - Created 2 separate spans
get /mongo-async-await
.mongoose.users.findOne
.Zipkin Screenshot:
I'm using TypeScript, attaching my set up for reference:
Typescript version: 3.8.3
tsconfig:
The text was updated successfully, but these errors were encountered: