# Elastic APM RUM JS Agent - Grouping http-request transactions

**URL:** <https://discuss.elastic.co/t/elastic-apm-rum-js-agent-grouping-http-request-transactions/215380>\
**Category:** APM\
**Tags:** rum\
**Created:** [January 16, 2020, 7:32pm UTC](https://discuss.elastic.co/t/elastic-apm-rum-js-agent-grouping-http-request-transactions/215380 "2020-01-16T19:32:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chandra2037](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra2037/32/72142_2.png) [@chandra2037](https://discuss.elastic.co/u/chandra2037)\
**Post date:** [January 16, 2020, 7:32pm UTC](https://discuss.elastic.co/t/elastic-apm-rum-js-agent-grouping-http-request-transactions/215380/1 "2020-01-16T19:32:25Z")

</div>

**Kibana version** : 7.4.0

**Elasticsearch version** : 7.4.0

**APM Server version** : 7.4.0

**APM Agent language and version** : `@elastic/apm-rum-angular` 0.4.0. Angular 8.2.14.

**Fresh install or upgraded from other version?** Fresh

**Is there anything special in your setup?** Followed the [Angular Integration](https://www.elastic.co/guide/en/apm/agent/rum-js/master/angular-integration.html) instructions

Thanks to the new APM RUM Angular release v0.4.0, able to capture the standalone Ajax requests as `http-request` transaction type. Describing my question below:

URL's in our application follows something like

`https://test.org/api/v1/testservice/testendpoint/id/`

APM RUM Agent reporting standalone `http-request` transactions as

```
GET https://test.org/api/v1/testservice/testendpoint/test-id1/
POST https://test.org/api/v1/testservice/testendpoint/test-id1/

```

Is there any way to group all http-request transactions for the same endpoint, for the above example it should be like

`https://test.org/api/v1/testservice/testendpoint/`  
or  
`/testservice/testendpoint/`

Without grouping, APM view is getting cluttered large number of same endpoint transactions with different ids.

Thank you for any suggestions.

Regards,  
Chandra

---

<div class="post-metadata">

**Author:** ![Hamidreza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamidreza/32/21369_2.png) [@Hamidreza](https://discuss.elastic.co/u/Hamidreza)\
**Post date:** [January 17, 2020, 11:41am UTC](https://discuss.elastic.co/t/elastic-apm-rum-js-agent-grouping-http-request-transactions/215380/2 "2020-01-17T11:41:34Z")

</div>

Hi @chandra2037,

Thanks for using our latest release.  
That's a good suggestion. We have considered resolving these types of issues in different layers of our product, e.g. in the APM UI. I've also created an [issue](https://github.com/elastic/apm-agent-rum-js/issues/577) to address this problem in the agent itself.

In the meantime, you can modify any transaction by registering an [event listener](https://www.elastic.co/guide/en/apm/agent/rum-js/current/agent-api.html#observe), for example:

```auto
apm.observe('transaction:end', function (transaction) {
  if (transaction.type === 'http-request') {
    let url = transaction.name.split(' ')[1]
    transaction.name = url.split('/').slice(0,-1).join('/')
  }
})

```

Hope this helps.

Cheers,  
Hamid

---

<div class="post-metadata">

**Author:** ![chandra2037](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra2037/32/72142_2.png) [@chandra2037](https://discuss.elastic.co/u/chandra2037)\
**Post date:** [January 17, 2020, 8:05pm UTC](https://discuss.elastic.co/t/elastic-apm-rum-js-agent-grouping-http-request-transactions/215380/3 "2020-01-17T20:05:53Z")

</div>

Thank you @Hamidreza. As you mentioned, we will use event listener. This is very helpful.

Regards  
Chandra

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 7, 2020, 4:05pm UTC](https://discuss.elastic.co/t/elastic-apm-rum-js-agent-grouping-http-request-transactions/215380/4 "2020-02-07T16:05:56Z")

</div>

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