What is the status of APM (In Mongo node.js native driver)?

Hello @Eddy_Wilson!
Rest assured the status of APM in the node driver is that the functionality is fully supported and will be going forward. However, it does seem we have some confusing documentation that hasn’t made clear what is legacy and what is best practice. I have filed a ticket for this and we will update the docs as soon as we can.

Today all drivers share the same monitoring events for a uniform database experience. In node it would like something like this:

const client = new MongoClient(URL, options)
client.on('commandStarted', event => {/* event handling... */})
client.on('commandSucceeded', event => {/* event handling... */})
client.on('commandFailed', event => {/* event handling... */})
// SDAM events can also be listened to in the same way

await client.connect()
// etc..

In 4.0 the instrument method will likely be removed and it will be deprecated in 3.6. However, the 4.0 version is still an in progress beta so if you are targeting production I would hold off on deploying with the beta version of the driver. The code above will still work in either version of the driver.

Hopefully this helps! Let me know if there’s anything still unclear.

1 Like