Custom Transactions no longer detect external.http spans automatically

I am upgrading my JS agent from 3.0.0 to 4.5.0 and the custom transactions I had already implemented no longer work. I have an angular app so I am using angular-rum 0.2.0.

I have enabled debug mode so I can see it is detecting external.http spans but somehow not including them in the customs transaction I created.

Can anyone say what I am doing wrong?

Here is an example:

TransactionService.startTransaction Transaction {name: "XXX", .....}
logging-service.js:56 TransactionService.startSpan POST http://localhost:8080/XXX external.http
logging-service.js:56 TransactionService.addTask task1
logging-service.js:56 TransactionService.removeTask task1
logging-service.js:56 TransactionService.startSpan GET http://localhost:8080/YYY external.http
logging-service.js:56 TransactionService.addTask task1
logging-service.js:56 TransactionService.removeTask task1
logging-service.js:56 TransactionService transaction finished Transaction {name: "XXX",...}
logging-service.js:56 Transaction was discarded! Transaction does not include any spans
logging-service.js:56 Could not create a payload from the Transaction Transaction {name: "XXX",...}
logging-service.js:56 TransactionService.add Transaction {name: "XXX",...}

Hi Kartheek,

Agent 3.x and 4.5 differs in a way how managed(automatic instrumentation) and custom transactions works. There can be only 1 active managed transaction at a time and can be multiple custom transactions. If you are creating custom transactions, you would need to explicitly add spans to that transactions since all automatic instrumented spans would get added to the managed transactions. An example would be

const tr = apm.startTransaction('my-custom-tr', 'custom');

const span = tr.startSpan('ex-function');
(function expensiveFunction() {
// code

The transaction tr would only contain the ex-function span and would not include any XHR or resource timing spans captured during the transaction time frame.

From the logs, I see that the transaction XXX does not include any spans and therefore discarded. Could you please paste a snippet of code on whether the custom transaction contains any spans and you can also check if there an active transaction by calling apm.getCurrentTransaction().

The logging needs a bit of work and I will create an issue in the RUM repo to address it which would clear any confusion.


In my code I do not create a span explicitly. I was relying on the agent to automatically pick the spans that occurred after a transaction was created.

Once I use the startSpan method I can see the spans but that makes the thing we want to track harder since its not automatically tracked anymore. That was definitely a useful feature.

If you are creating the transaction through custom API, you can use the managed option in the API so that the custom transaction becomes managed one and all automatically instrumented spans would be added to them.

apm.startTransaction('custom', 'custom', {
    managed: true


1 Like

That sounds good. I will give it a try.

@vigneshshanmugam - Do you know what version of the JS agent the custom API will be available? I am using 4.5.0 and I don't see an option to send in a 3rd parameter.

@Kartheek_Mannepalli Its available from 4.5.0, Check the changelog


@vigneshshanmugam - Sorry I was looking at the wrong version. I will give this a try. Thanks.

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