-
Notifications
You must be signed in to change notification settings - Fork 399
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
Support knex/thenables #598
Comments
Hi @JaneJeon ! Thank you for the request and the really thorough description of a possible workaround. I will bring this up with our Product Manager and we'll get this prioritized. If you're feeling ambitious, PRs are welcome to add this functionality. Thanks again! |
Hi, any update on this? It is a hard blocker for not just me, but anyone using knex (or any library that uses its own promise implementation, which is a surprising number of them). |
Hi @JaneJeon, We do not yet have this scheduled on our roadmap. I know at least a few customers have asked for knex support so this will be balanced with those requests as the PM makes roadmap decisions. I'll go ahead and make them re-aware of this issue, too. Thank you, Michael |
Another +1! Having 0 visibility into queries in new relic just because of Knex is really a kick in the shin |
A user reported a workaround:
|
For posterity, the Original code:
Attempt one:
Attempt two:
|
Is it even worth voting on this FR anymore? https://discuss.newrelic.com/t/feature-idea-knex-support-in-nodejs-client/67212/7 |
I'm considering as an alternative, ditching the newrelic node agent altogether and leveraging opentelemetry.io and its flexible and extensive list of instrumentation plugins (knex included: https://www.npmjs.com/package/@opentelemetry/instrumentation-knex) and configure it with a newrelic exporter to send that to newrelic for analysis. Perhaps others would want to check that out too. |
@robertoandrade For what it's worth, I've simply switched over to ddog. I couldn't wait a year+ for this basic feature. |
We started using https://vincit.github.io/objection.js/ which uses Knex underneath, so we are running into this problem now as well. I'd be happy to lend a hand as needed, but I don't have much experience in the Node.js world. |
I'm having this same problem in datadog as well, just to other people know that too. |
Hi, I googled this but was unable to find any reference to this.
Currently, knex.js (which is a heavily used/depended-on library in the nodejs space) basically “slurps up”
.then()
chains, which means it removes reference to the original stack trace on every async call. This is a well-known issue, and both datadog and elastic-apm have specifically built workarounds for this:https://github.com/DataDog/dd-trace-js/blob/master/packages/datadog-plugin-knex/src/index.js
https://github.com/elastic/apm-agent-nodejs/blob/master/lib/instrumentation/modules/knex.js
However, it does not seem like newrelic’s agent takes care of scenarios like this where the stack trace is lost through async calls (I believe it’s not only knex, but a couple of other libraries that have this behaviour as well - for example, I’ve heard that apollo-server also has a similar behaviour with async stack traces).
Currently, this would be a hard blocker for any production application utilizing knex.js directly or even indirectly to adopt newrelic’s APM. I don’t know if a fix for this is already implemented, but if not, I would request that newrelic’s APM implement it as well.
Thanks!
Related issues:
elastic/apm-agent-nodejs#873
DataDog/dd-trace-js#563
The text was updated successfully, but these errors were encountered: