# Can we enable stack trace for all the calls in the Custom Python Tracing

**URL:** <https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540>\
**Category:** APM\
**Tags:** python\
**Created:** [February 2, 2023, 12:17pm UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540 "2023-02-02T12:17:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dixit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dixit/32/111369_2.png) [@Dixit](https://discuss.elastic.co/u/Dixit)\
**Post date:** [February 2, 2023, 12:17pm UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/1 "2023-02-02T12:17:15Z")

</div>

hi @basepi & @lwintergerst ,

How can we enable stack trace for all the calls in the waterfall model.

Right now errors /exceptions has the stack trace.

Want to track all the calls which are greater than 5 seconds with stack trace attached when we try to see the details .

is this possible, I know overhead would be accounting for the same.

Thanks,  
Dixit

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [February 2, 2023, 6:19pm UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/2 "2023-02-02T18:19:34Z")

</div>

Please stop mentioning Elastic team members directly. If you create a post on the APM forum labeled `python`, we will see it.

All spans longer than [`span_stack_trace_min_duration`](https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html#config-span-stack-trace-min-duration) should have stack traces attached by default.

---

<div class="post-metadata">

**Author:** ![Dixit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dixit/32/111369_2.png) [@Dixit](https://discuss.elastic.co/u/Dixit)\
**Post date:** [February 3, 2023, 12:16am UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/3 "2023-02-03T00:16:49Z")

</div>

Thank you  
Will try and let you know

---

<div class="post-metadata">

**Author:** ![Dixit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dixit/32/111369_2.png) [@Dixit](https://discuss.elastic.co/u/Dixit)\
**Post date:** [February 8, 2023, 5:26pm UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/4 "2023-02-08T17:26:50Z")

</div>

hi ,

Am not getting stack trace even though [`span_stack_trace_min_duration`](https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html#config-span-stack-trace-min-duration) is added and set to 0 or some value in "ms" format.

Not sure why, can you help me. Where exactly if I place this I get a stack trace, am experimenting

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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/b/8b74ceb81ef61a9a51d999e64880cbc868fec0b5.png)

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [February 8, 2023, 8:59pm UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/5 "2023-02-08T20:59:38Z")

</div>

You're looking in the correct place. That's where I see stack traces for spans in our test cluster.

Can you show me all of your (sanitized) config values? I want to make sure we're not missing something in configuration.

---

<div class="post-metadata">

**Author:** ![Dixit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dixit/32/111369_2.png) [@Dixit](https://discuss.elastic.co/u/Dixit)\
**Post date:** [February 9, 2023, 5:10pm UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/6 "2023-02-09T17:10:10Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/4/6/467e8fe70ec4d0fe0360f1c301628259bc1c48f7.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/8/385ce18a9978c49edfc47cb31647cd963dcf3660.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/3/e35aed017b906ef35780b86f36f2b3a08256f744.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/3/e31bd87e1bcf4603c97fe43f84c1a8834fc74e92.png)

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [February 9, 2023, 5:39pm UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/7 "2023-02-09T17:39:49Z")

</div>

In your screenshot, you have `span_frames_min_duration` set to 5ms, and the span you were looking at was 1.3ms.

`span_stack_trace_min_duration` is replacing `span_frames_min_duration` but I'm not sure which version of the UI will have that change. The new setting will take precedence, but the old setting will still work if the new setting is not set.

---

<div class="post-metadata">

**Author:** ![Dixit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dixit/32/111369_2.png) [@Dixit](https://discuss.elastic.co/u/Dixit)\
**Post date:** [February 10, 2023, 12:14am UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/8 "2023-02-10T00:14:07Z")

</div>

Then will delete / reset the configs then try to see the stack trace.

What would be the default setting look like , any example would help

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [February 10, 2023, 5:00pm UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/9 "2023-02-10T17:00:33Z")

</div>

If you want to see stack traces from all spans (including the short ones), you would set that setting to `0ms` in Kibana.

Alternatively, you could configure it on the agent side, either via environment variables or in-code config.

Note that collecting stack traces has some performance overhead. We assume that most users won't want to inspect the stack trace on spans that are less than 5ms, because they are usually not the problematic spans. Thus, the default of 5ms.

---

<div class="post-metadata">

**Author:** ![Dixit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dixit/32/111369_2.png) [@Dixit](https://discuss.elastic.co/u/Dixit)\
**Post date:** [February 11, 2023, 12:29am UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/10 "2023-02-11T00:29:10Z")

</div>

Yes 5 ms is fair enough. My question is I want to see what is going in as in for memmcache, trying to trace that.

Any documentation for kibana would help where the setting needs to be

---

<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 3, 2023, 8:29pm UTC](https://discuss.elastic.co/t/can-we-enable-stack-trace-for-all-the-calls-in-the-custom-python-tracing/324540/11 "2023-03-03T20:29:38Z")

</div>

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