APM nodejs agent Errors not Showing in Kibana

// Add this to the VERY top of the first file loaded in your app
var apm = require('elastic-apm-node').start({
// Override service name from package.json
// Allowed characters: a-z, A-Z, 0-9, -, _, and space
serviceName: 'name',

// Use if APM Server requires a token
secretToken: '',

// Set custom APM Server URL (default: http://localhost:8200)
serverUrl: 'http://ip:8200'
})

I am adding this at the top of the file. metrics are showing but errors are not showing.
Thanks

You may want to check if the exceptions you're dealing with are caught or uncaught. For the latter, the property logUncaughtExceptions must be set. See here.

Also, the Node.js agent also allows you to log errors using the API manually:

@riferrei

@riferrei Hi, thanks for the reply
I tried this one to add in my app file
var err = new Error('Ups, something broke!')

apm.captureError(err)
it is showing messages only.it is not showing when the app got errors. I want errors when the app went down and any databases issue with that app.
thanks

Oh, this is unfortunate. I'm sure you did this but were any errors flowing through the app to try when you tested? Also, any error from the database communication is propagated through the upper layers? I don't know much of JS architecture, but exceptions can't be caught and handled if the upper layers need to handle them. If the interaction with the database is handled by some layer that is not from the app side (such as a REST API DAO component that encapsulates the persistence logic) then you would need to propagate the transaction context using the distributedTracingOrigins parameter.

Also important to check if your app uses some of the compatible frameworks with RUM:

@riferrei

@vamshi31 Hi! I work on the node.js APM agent. Are you able to show an example of an error that isn't being caught?

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