Atatus APM automatically instruments all web requests. In case you want to instrument web sockets calls, background jobs, and unsupported databases, you need to use custom instrumentation as follows:

copy
icon/buttons/copy
var atatus = require("atatus-nodejs");
atatus.startBackgroundTransaction("background transaction name");
var span = atatus.startSpan("custom span name");
// Your code here.
if (span) span.end()
atatus.endTransaction();
copy
icon/buttons/copy
var atatus = require("atatus-nodejs");
atatus.startBackgroundTransaction("new:chat-message");
socket.on("message", function (data) {
    var span = atatus.startSpan("add:message:firebase");
    addMessageToFirebase(data, function () {
        socket.emit("got the message");
        span.end()
        atatus.endTransaction();
    });
});

Transaction timing consists of spans(aka layers). Every transaction must have at least one span. Any database calls will be added automatically as a span to the transaction.