Hello I have node js app that is basically a script, which exits immediately after execution. I use newrelic.recordCustomEvent(title, payload) to send my payloads to new relic, which I then query using insights. But the problem is unless I some how artifically slow down the script, such as putting it to sleep for 20 seconds, the newrelic agent wont have time to harvest events. Can you help me find out what I can do to make sure events are harvested before process terminates?
Script Terminating Before Events are Harvested by Node.js Agent
Hi, @OAmjadi: You might try calling the newrelic.shutdown()
method with the collectPendingData
option before the application ends, to tell the agent to send its data.
2 Likes