This page explains the relationship between transaction snapshots and process snapshots created by the Node.js Agent.

V8 Sampler

Node.js is built on the V8 JavaScript engine, which includes a code sampler.

The Node.js Agent uses the V8 sampler to create process-wide process snapshots, which contain call graphs of the methods on the Node.js process's call stack.

Call Graph Data in Snapshots

Call graph data displays in business transaction snapshots as well as process snapshots.

When you view a business transaction snapshot, the displayed call graph specific to the transaction instance is derived from the concurrent process snapshot call graph.

When you view a process snapshot, the complete call graph of all the business transactions executed while the process snapshot was captured is displayed.

The call graph in a business transaction snapshot displays a view of the data from a concurrent process snapshot that is filtered to display only time in methods attributable to the specific business transaction. It is a subset of the concurrent process snapshot call graph.

For this reason, you might see an execution time for a method in a business transaction call graph that is less than the execution time for the same method in the concurrent process snapshot call graph. This would indicate that some calls to that method were made outside the context of the business transaction instance captured by the transaction snapshot.

The summary tab of a transaction snapshot includes a link to the process snapshot that was taken during the time covered by the transaction snapshot.

Business Transaction Snapshots Trigger Process Snapshots

To provide call graph data associated with business transaction snapshots, the agent starts a ten-second process snapshot whenever it starts a business transaction snapshot that is triggered by periodic collection or a diagnostic session if there is no existing process snapshot in progress for the current process. Process snapshots do not overlap. Periodic collection means that a business transaction is collected at periodic intervals, by default every ten minutes, but configurable. Diagnostic session means that either the agent has detected a pattern of possible performance issues and automatically started capturing transaction snapshots or a human has manually started a diagnostic session for the same reason.

Concurrent Business Transaction and Process Snapshots

The result presented is a process snapshot that ran concurrently with a business transaction. How well the two snapshots line up depends on the relative durations and start times of the transaction and the process snapshots.

In the scenario sketched below, all of the five-second blue transaction's calls, and most of the 10-second green transaction's calls are captured by a 10-second process snapshot, but only the about half of the 14-second orange transaction snapshot's calls.

Business Transaction and Process Snapshot Diagram

If you find that your business transactions are running longer than your process snapshots, you can increase the default length of a process snapshot in the autoSnapshotDurationSeconds setting in the require statement.