The `chrome-trace-event` library provides a programmatic interface for Node.js applications to generate detailed performance logs in Google's Trace Event format. These logs, typically JSON files, can then be loaded and visualized using powerful analysis tools such as `chrome://tracing` in Chrome DevTools or Google's `trace-viewer`. This allows developers to gain deep insights into their application's execution flow, identify bottlenecks, and understand inter-process communication or asynchronous operations. The current stable version is 1.0.4, which was last published over two years ago. Due to its age and lack of recent updates, its release cadence is effectively dormant. Its primary differentiator is its straightforward approach to producing a universally accepted profiling format that integrates directly into established Chrome-based visualization ecosystems.
npm install chrome-trace-eventVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Tracer, record various event types (duration, instant, counter), and write the collected trace data to a JSON file. The file can then be loaded into Chrome DevTools (`chrome://tracing`) for visualization.
Review the package's GitHub repository for forks or community-maintained versions if encountering compatibility issues with modern Node.js environments. Consider wrapping it or using a more actively maintained tracing library if extensive new features are required.
Always use ES module import syntax (`import { Tracer } from 'chrome-trace-event';`) in ES module contexts. If you must use `require` in an ESM file, you'll need to use `createRequire` from the `module` built-in module.Change your import statement to `import { Tracer } from 'chrome-trace-event';` and ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json` or `.mjs` file extension).No dependency data recorded yet.