Transaction APIedit

A transaction groups multiple traces in a logical group.

To get a Transaction object, you need to call apm.startTransaction().

To see an example of using custom transactions, see the Custom Transactions in Node.js article.


  • Type: String
  • Default: unnamed

The name of the transaction.

Can be used to set or overwrite the name of the transaction (visible in the performance monitoring breakdown). If you don’t have access to the current transaction, you can also set the name using apm.setTransactionName().

Transactions with the same name and type are grouped together.


  • Type: String
  • Default: custom

The type of the transaction.

There’s a special type called request which is used by the agent for the transactions automatically created when an incoming HTTP request is detected.


  • Type: Number
  • Default: 200

The transaction result.

Think of the transaction result as equivalent to the status code of an HTTP response.



Ends the transaction and truncates all un-ended child traces. If the transaction has already ended, nothing happens.

Alternatively you can call apm.endTransaction() to end the active transaction.