Q64: What are Node.js Diagnostic Reports and how are they generated?

Diagnostic Reports are JSON-formatted summary files generated by Node.js containing detailed runtime information, including call stacks, native stack traces, heap statistics, system environment variables, resource usage, and loaded native modules. They can be triggered automatically on crashes, uncaught exceptions, or fatal memory exhaustion, or manually using process.report.writeReport() or the command-line flag --report-uncaught-exception.

Key Takeaways
  • Diagnostic reports output comprehensive JSON diagnostics for troubleshooting production crashes.
  • They capture call stacks, heap stats, native OS information, and process arguments without external tools.
Knowledge Check

What format do Node.js Diagnostic Reports use to store runtime statistics?