Support knex/thenables
See original GitHub issueHi, 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: https://github.com/elastic/apm-agent-nodejs/issues/873 https://github.com/DataDog/dd-trace-js/pull/563
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:10 (3 by maintainers)
Another +1! Having 0 visibility into queries in new relic just because of Knex is really a kick in the shin
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).