Host metrics vs APM
Infrastructure monitoring shows the machine. APM shows the process — transactions, throughput, errors, and (with setup) application logs.
By default you may see host / nginx-style logs — not your app’s own logs — until application logging is enabled (next lesson).
Set up Node.js APM
In New Relic: add a data source → Node.js → install on the host.
npm install newrelic expresspackage.json script
{
"scripts": {
"start": "NEW_RELIC_APP_NAME=test NEW_RELIC_LICENSE_KEY=YOUR_LICENSE_KEY node -r newrelic index.js"
}
}Or require the agent first in code (agent must load before Express):
require("newrelic");
const express = require("express");
const app = express();
app.get("/", (req, res) => {
console.log("route hit");
res.json({ message: "hi there" });
});
app.listen(3000, () => {
console.log("listening on port 3000");
});npm startGenerate traffic
npm i -g loadtest
loadtest -c 10 --rps 200 http://localhost:3000/Open the APM dashboard for your app — transactions, response time, throughput.
Never commit license keys. Use env vars or a secrets manager.