# All spans not being captured in custom transactions

**URL:** <https://discuss.elastic.co/t/all-spans-not-being-captured-in-custom-transactions/326648>\
**Category:** APM\
**Tags:** java\
**Created:** [February 28, 2023, 6:20am UTC](https://discuss.elastic.co/t/all-spans-not-being-captured-in-custom-transactions/326648 "2023-02-28T06:20:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarthik](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@sarthik](https://discuss.elastic.co/u/sarthik)\
**Post date:** [February 28, 2023, 6:20am UTC](https://discuss.elastic.co/t/all-spans-not-being-captured-in-custom-transactions/326648/1 "2023-02-28T06:20:35Z")

</div>

I am capturing the custom spans for a transaction and storing it in '_ **Transaction.custom** _'.  
I am using "_**Thread.getAllStackTraces()**_" inside "_**beforeEnd()**_" function in "_ **co.elastic.apm.agent.impl.transaction.Transaction.java** _". But in this case some of my spans inside the transactions are not being captured.  
In a naïve language, I can say that all classes are not being captured with this.  
Please help me I this regard, as I want to capture all the classes for the particular transaction.

**Kibana version** : 8.5.1

**Elasticsearch version** : 8.5.1

**APM Server version** : 8.5.1

**APM Agent language and version** : Java and 1.x.x

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [February 28, 2023, 6:43am UTC](https://discuss.elastic.co/t/all-spans-not-being-captured-in-custom-transactions/326648/2 "2023-02-28T06:43:47Z")

</div>

This topic looks very similar to: [Want to get interface classes for the current transaction](https://discuss.elastic.co/t/want-to-get-interface-classes-for-the-current-transaction/326307).  
I obviously couldn't understand what this is about and how we can assist.  
Hopefully someone else can.  
Good luck!

---

<div class="post-metadata">

**Author:** ![sarthik](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@sarthik](https://discuss.elastic.co/u/sarthik)\
**Post date:** [February 28, 2023, 6:55am UTC](https://discuss.elastic.co/t/all-spans-not-being-captured-in-custom-transactions/326648/3 "2023-02-28T06:55:02Z")

</div>

Hi,  
I was able to capture interfaces, but all the spans are not being captured for their interfaces to get captured.

---

<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:** [March 21, 2023, 2:55am UTC](https://discuss.elastic.co/t/all-spans-not-being-captured-in-custom-transactions/326648/4 "2023-03-21T02:55:28Z")

</div>

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