Get the transaction.id

Hi there,

Is there any way to get the transaction.id of the current transaction agent side ? (I specify a name for the transactions using apm.setTransactionName('myName))

The idea is to add the transaction.id to the logfiles so a specific transaction identified in the logfiles can be easily found in kibana.

Ok, forget me :slight_smile:

Searching a little bit more, I found apm._instrumentation.currentTransaction.id (nodejs agent)
I can use this to log the transaction ID.

You should use apm.currentTransaction, so you don't go through the private _instrumentation property:

apm.currentTransaction.id

I just realized that we haven't documented the id property in the transaction documentation (we should do that), but you shouldn't expect the ID to be of a specific format, as we might change that soon. But it will remain a string.

Hi, thank you for the apm.currentTransaction , I will use that, whaterver is the format as long it's a string.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.