Node.js Agent not instrumenting Mongoose

Hi guys,

I'm running a trial on Elastic Cloud and I'm trying to instrument a Node.js API.
In general, the transactions are showing just fine.

However, I think there's two items that are not working well.

  1. Mongoose not being instrumented
    I see other modules (ie session) which are using the same mongo connection that get database spans.
    Some calls do get instrumented, like new Model({}).save(). On the other hand, stuff like find or findOneAndUpdate are not getting instrumented.

  2. No "own" code spans
    Please correct me if I am wrong but the agent is supposed to trace our own code.

Some details:
Node version: 12.7.0
Agent version: 2.17.0
Mongoose version: 5.3.14

Thanks in advance for any possible insight here.

Cheers,
Helder

Hi @hpinhal

We can see find calls just fine using mongoose and elastic-apm-node v2.16.2. We're using the ES6 import fix with elastic-apm-node/start to make sure we import the lib at the very top. Maybe that is your issue?

Unfortunately no luck.
We're using Typescript, and the import just like mentioned in the documentation.
It's not the very very first import item tho. dotenv comes first but that shouldn't be causing this.

I'm having a hard time understanding why it works for certain write operations but never for read ops.

Turns out.... There's no support for mongodb 3.3 since it dropped support for mongodb-core.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.