Taking node-report without running another instance of the process
nikhilagrawal577 opened this issue · 8 comments
I want to take node-report of a running process in the application.
But it should not create another instance of that process or restart the existing process.
Os : Linux
Can you explain a bit more ? I think you may be able to request a node-report through signals. Another option is using https://www.npmjs.com/package/appmetrics which provides GUI through which a report can be requested.
In Production, when application is already running. I want to get inside the container and take the node-report without impacting the running application.
And it should not create additional process to take node-report.
You should be able to trigger a node-report by requiring the module in your application and sending a USR2 signal to the process, see example here:
https://developer.ibm.com/node/2017/02/14/announcing-node-report-version-2-1-0-essential-diagnostic-node-js-applications/
There is no additional process instance, and minimal impact on the application.
I don't want to kill the process for it. I dont want to change the code by putting the required module.
In Java we have Jmap or Jstack to take details during run time.
Similarly do we have something in Nodejs to do the same ?
Sending USR2 to the process does not kill it, the application continues.
You don't have to change the code to add the module. Just add -r node-report
into the command line when you start the application.
If the application is already running, in that case what can be done to get the node-report ?
It's not a core/built-in feature in Node.js, so it's not there by default like jmap/jstack or thread dumps in Java.
Node.js does have a debug agent on by default, which you can activate using a USR1 signal, see https://nodejs.org/en/docs/inspector/ or search for docs on debug/inspector.
Did did discuss in the Diagnostic summit that we should pull node-report into node core, but at @rnchamberlain says, right now its not there by default.