// 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: '',
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 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:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.