Hi,
We have started to use APM and elastic-apm-node to instrument our node application. We get a lot of great information from the express routes which has helped us a lot.
We have recently started to track background jobs as well using custom transactions, but there seems to be an issue with memory never being released when a custom transaction is closed. The application will continue to consume memory until it is out of memory and the application is restarted. The background jobs typically runs for a couple of minutes and generate some 200 spans, so I expect some additional memory usage. But when the transaction is closed I would assume the the memory is released.
We start a custom transaction like this:
import * as APM from "elastic-apm-node";
const trans = APM.startTransaction("JobName", "Job");
try {
await CacheRunner._runJob(taskDef, task.params);
} catch (err) {
trans.result = 500;
trans.end();
throw err;
}
trans.result = 200;
trans.end();