We can’t deny the importance of Node.js and it is especially wonderful to see when some utilities are brought into the Node.js core because they can help identify numerous problems, for example, support issues sent to the different repositories. Yes, we are going to tell you how the Diagnostic Report utility was recently brought into the Node.js and how it changed our lives.The Diagnostic Report utility was recently brought into the Node.js core to help developers find out all scenarios of Node.js application problems in production. The Diagnostic Report is an experimental tool that is built into the Node.js core. Data that it captures could be related to problems like fatal errors that terminate the program, application exceptions, or any other common failure scenarios.
A few command line arguments are available to control the report generation triggers:
--experimental-reportenables report generation
--diagnostic-report-on-fatalerror generates a diagnostic report on fatal (internal) errors
--diagnostic-report-on-signal generates a diagnostic report upon receiving signals
--diagnostic-report-signal=...causes a diagnostic report to be produced on a provided signal.
--diagnostic-report-uncaught-exceptiongenerates a diagnostic report on uncaught exceptions
--diagnostic-report-directory=... defines custom report pathname
--diagnostic-report-filename=... defines a custom report file name.
Diagnostic Report is available as an experimental feature from Node.js v11.8.0 and subsequent releases. The tool could exit the experimental status and become a stable and supported feature, based on:
- The perceived usability in the field
- Any tuning that may be required at the API interface level.
Please feel free to check how it works here.
Btw, while this feature is experimental, did you know that most of Node.js features were experimental at first too?