# How does apm decides when does it needs to trace the methods

**URL:** <https://discuss.elastic.co/t/how-does-apm-decides-when-does-it-needs-to-trace-the-methods/238065>\
**Category:** APM\
**Tags:** java\
**Created:** [June 22, 2020, 10:39am UTC](https://discuss.elastic.co/t/how-does-apm-decides-when-does-it-needs-to-trace-the-methods/238065 "2020-06-22T10:39:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [June 22, 2020, 10:39am UTC](https://discuss.elastic.co/t/how-does-apm-decides-when-does-it-needs-to-trace-the-methods/238065/1 "2020-06-22T10:39:32Z")

</div>

How does APM decides when does it needs to trace the java methods using java agent. Can those value be finetuned so that we can get even more trace informations?

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [June 22, 2020, 3:01pm UTC](https://discuss.elastic.co/t/how-does-apm-decides-when-does-it-needs-to-trace-the-methods/238065/2 "2020-06-22T15:01:42Z")

</div>

Check out this part of the docs: [https://www.elastic.co/guide/en/apm/agent/java/current/java-method-monitoring.html](https://www.elastic.co/guide/en/apm/agent/java/current/java-method-monitoring.html)

Let me know if you have any further questions.

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [June 23, 2020, 10:07pm UTC](https://discuss.elastic.co/t/how-does-apm-decides-when-does-it-needs-to-trace-the-methods/238065/3 "2020-06-23T22:07:12Z")

</div>

I have this notification in few of the apm stacks.

 ![Screenshot 2020-06-24 at 01.05.34](https://us1.discourse-cdn.com/elastic/original/3X/e/9/e92071aa6eb485f0b68d550966590f7e6e54ec90.png)  
Is there anywhere documented what is the default number of items in a trace and if that number can be configured then how to do it?

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [June 24, 2020, 3:04pm UTC](https://discuss.elastic.co/t/how-does-apm-decides-when-does-it-needs-to-trace-the-methods/238065/4 "2020-06-24T15:04:12Z")

</div>

There's a setting for both the agent ([`transaction_max_spans`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-transaction-max-spans)) and the UI ([`xpack.apm.ui.maxTraceItems`](https://www.elastic.co/guide/en/kibana/current/apm-settings-in-kibana.html#general-apm-settings)).

---

<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:** [July 15, 2020, 11:04am UTC](https://discuss.elastic.co/t/how-does-apm-decides-when-does-it-needs-to-trace-the-methods/238065/5 "2020-07-15T11:04:14Z")

</div>

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