# APM: joining spans and transactions

**URL:** <https://discuss.elastic.co/t/apm-joining-spans-and-transactions/230645>\
**Category:** Kibana\
**Created:** [April 30, 2020, 11:05pm UTC](https://discuss.elastic.co/t/apm-joining-spans-and-transactions/230645 "2020-04-30T23:05:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emanuel\_Velzi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emanuel_velzi/32/66975_2.png) [@Emanuel\_Velzi](https://discuss.elastic.co/u/Emanuel_Velzi)\
**Post date:** [April 30, 2020, 11:05pm UTC](https://discuss.elastic.co/t/apm-joining-spans-and-transactions/230645/1 "2020-04-30T23:05:46Z")

</div>

Hi!

I am using Elastic APM and I need to know **how much time spent a transaction accessing to my MongoDB**.

For that I'm trying to make a **table visualisation on Kibana** joining data about transactions and spans but I have some problems.

**When I filter by a specific `trace.id`, I can see the data; else, I do not see mongodb time.**

These are the cases:

 ![s-monitoring-kibana-00_9290_kibana_app_kibana (4)](https://us1.discourse-cdn.com/elastic/original/3X/6/b/6b3cf6ae6555dde0047d66e69bd7d339d7fec399.png)

Error case (generic):

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/0/60722b5a82544daee00ec27f1589ef378c9e74f9.png)

Happy case (specific trace.id):

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/1/f197c6d89a0f18af47c3cdd25246888e7bef7597.png)

As you can see, in the second case when I'm filtering by a specific transaction, I can cross the data and achieve my metrics.

But how can I make this in a more generic way for all transactions? Is this possible?  
I have invested a lot of time trying with aggregations because I know that a simple join (like SQL) is not possible but I do not understand how I could achieve my final table.

Can someone help me?

---

<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:** [May 28, 2020, 11:05pm UTC](https://discuss.elastic.co/t/apm-joining-spans-and-transactions/230645/2 "2020-05-28T23:05:58Z")

</div>

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