The Atatus Node.js agent helps you in troubleshooting your Node.js application problems and also identifies performance issues before it becomes apparent to your users. It also captures unhandled exceptions and HTTP failures in production to determine which part of your Node.js application is slower or producing lots of errors.
Create a free account to start monitoring your Node.js apps.
Installation & Setup
If you want to include Atatus script with your source, you need to integrate from package managers.
Install Atatus Node.js package.
copynpm install --save atatus-nodejs
Require Atatus in your Node.js app and invoke start with your License key and App name:
copy// It must be placed above all other 'require' statements var atatus = require("atatus-nodejs"); atatus.start({ licenseKey: "YOUR_LICENSE_KEY", appName: "YOUR_APP_NAME" });
For more advanced options on installing your monitoring code, view customizing agent.
Restart your Node.js server.
Just restart your server and access it from your web app or mobile app or curl. You will visualize your application's metrics within minutes.
require("atatus-nodejs")
should be the first line of your server code(example: server.js or index.js) and placed above all other 'require' statements. Otherwise instrumentation will not work.
For ES Modules (Babel, TypeScript)
If you are using Atatus Node.js agent, for instance along with Babel, TypeScript for Node.js, all import statements are evaluated prior to calling any functions. Therefore, you need to import the atatus-nodejs/start module before all other 'import' statements.
Install Atatus Node.js package.
copynpm install --save atatus-nodejs
Import atatus-nodejs/start in your Node.js app.
copy// It must be placed above all other 'require' statements import atatus from 'atatus-nodejs/start'
Create a file atatus-config.js file in the current working directory with following contents.
copy// atatus-config.js module.exports = { licenseKey: "YOUR_LICENSE_KEY", appName: "YOUR_APP_NAME" }
For more advanced options on installing your monitoring code, view customizing agent.
Restart your Node.js server.
Just restart your server and access it from your web app or mobile app or curl. You will visualize your application's metrics within minutes.
For Node.js Cluster:
If you use Node.js cluster module, you must add the above code in the server node (server.js), not in the cluster node (cluster.js). See the example here.