Create and View Custom Trace Data in User Node.js Code


Tracing is a convenient way for developers to monitor and analyze application performance at runtime. Node.js offers a few options to generate and diagnose custom trace data in JavaScript applications.

The built-in trace mechanism supports centralized tracing for not only V8 and Node.js core, but also userspace code. For the userspace tracing, Node provides the async_hooks and embedder API to trace async resources. Additionally the developers can produce trace data for their own code segments which is not formally documented.

In this tutorial, follow the steps to define a new trace category, generate custom trace data into the standard Node trace log file, and visualize trace data for centralized performance analysis.

Learning objectives

After completing this guide you will know how to:

  • Define, enable, and disable a trace category in a Node application.
  • Add custom trace events and parameters into a Node application.
  • View the custom trace data generated by a Node application.

Read more at IBM Developer