# Make a span becomes transaction

**URL:** <https://discuss.elastic.co/t/make-a-span-becomes-transaction/325711>\
**Category:** APM\
**Tags:** java\
**Created:** [February 16, 2023, 9:57am UTC](https://discuss.elastic.co/t/make-a-span-becomes-transaction/325711 "2023-02-16T09:57:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Hosea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivan_hosea/32/117268_2.png) [@Ivan\_Hosea](https://discuss.elastic.co/u/Ivan_Hosea)\
**Post date:** [February 16, 2023, 9:57am UTC](https://discuss.elastic.co/t/make-a-span-becomes-transaction/325711/1 "2023-02-16T09:57:47Z")

</div>

**APM Agent language and version** :  
1.36

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
I tried to trace a method using this: [Core configuration options | APM Java Agent Reference [1.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-trace-methods)  
I successfully made a custom span with it, but I was wondering if I could turn that span into a transaction. The reason for this is because I would like to filter the traces based on that custom method.

---

<div class="post-metadata">

**Author:** ![Jack\_Shirazi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jack_shirazi/32/91641_2.png) [@Jack\_Shirazi](https://discuss.elastic.co/u/Jack_Shirazi)\
**Post date:** [February 16, 2023, 10:30am UTC](https://discuss.elastic.co/t/make-a-span-becomes-transaction/325711/2 "2023-02-16T10:30:39Z")

</div>

This should have created a transaction unless there was already a transaction active in which case it creates a span in that transaction

---

<div class="post-metadata">

**Author:** ![Ivan\_Hosea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivan_hosea/32/117268_2.png) [@Ivan\_Hosea](https://discuss.elastic.co/u/Ivan_Hosea)\
**Post date:** [February 17, 2023, 6:26am UTC](https://discuss.elastic.co/t/make-a-span-becomes-transaction/325711/3 "2023-02-17T06:26:07Z")

</div>

I see. However, in this example: [Elastic Demos](https://demo.elastic.co/app/apm/services/frontend-node/transactions/view?kuery=&rangeFrom=now-15h&rangeTo=now&environment=ENVIRONMENT_ALL&serviceGroup=&comparisonEnabled=true&transactionName=GET%20%2Frecommendations&transactionType=request&offset=1d&latencyAggregationType=avg&score=14.544306&timestamp=2023-02-17T06:21:14.879Z&transactionId=a05ccbd396b7c2ff&traceId=19abfd58914add87b8ea4d8c5fd7086d)  
it is possible that there is a transaction existing inside another transaction, is it because it comes from a different service?

Either way, is it not possible to make the previous custom span becomes a transaction if there was already a transaction active?

---

<div class="post-metadata">

**Author:** ![Jack\_Shirazi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jack_shirazi/32/91641_2.png) [@Jack\_Shirazi](https://discuss.elastic.co/u/Jack_Shirazi)\
**Post date:** [February 17, 2023, 12:01pm UTC](https://discuss.elastic.co/t/make-a-span-becomes-transaction/325711/4 "2023-02-17T12:01:58Z")

</div>

The link you have there shows a trace with multiple transactions/spans across several services. A transaction is also a span, one with [more information](https://www.elastic.co/guide/en/apm/guide/current/data-model-transactions.html). A trace is a request that contains one or more spans/transactions, linked by a common traceID.

If a transaction is active you can add spans to it, or end it and start another transaction

---

<div class="post-metadata">

**Author:** ![Ivan\_Hosea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivan_hosea/32/117268_2.png) [@Ivan\_Hosea](https://discuss.elastic.co/u/Ivan_Hosea)\
**Post date:** [February 20, 2023, 3:04am UTC](https://discuss.elastic.co/t/make-a-span-becomes-transaction/325711/5 "2023-02-20T03:04:10Z")

</div>

Okay, if that's the case. However, is there any way for me to filter traces to only feature the ones with a certain span inside it?

---

<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 12, 2023, 11:05pm UTC](https://discuss.elastic.co/t/make-a-span-becomes-transaction/325711/6 "2023-03-12T23:05:02Z")

</div>

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