FAQAPMHow do I integrate Node APM with Node.js cluster?

All you have to do is, to install the atatus-node from npm, and then add require('atatus-node') statement in the first line of your server code(NOT in your cluster code).

Please refer our example:

// index.js
var cluster = require('cluster');

if (cluster.isMaster) {
  // Count the machine's CPUs
  var cpuCount = require('os').cpus().length;

  // Create a worker for each CPU
  for (var i = 0; i < cpuCount; i += 1) {
    cluster.fork();
  }

  // Listen for dying workers
  cluster.on('exit', function () {
    cluster.fork();
  });
} else {
  require('./server');
}
// server.js
// This should be the first line of your server.js
var atatus = require('atatus-node');
atatus.start({ apiKey: 'YOUR_API_KEY' });

// Your Backend CODE