# Is it possible to get stack trace info on SQL spans from ruby agents?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-get-stack-trace-info-on-sql-spans-from-ruby-agents/235829>\
**Category:** APM\
**Tags:** ruby\
**Created:** [June 4, 2020, 6:02pm UTC](https://discuss.elastic.co/t/is-it-possible-to-get-stack-trace-info-on-sql-spans-from-ruby-agents/235829 "2020-06-04T18:02:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adnanrh](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@adnanrh](https://discuss.elastic.co/u/adnanrh)\
**Post date:** [June 4, 2020, 6:02pm UTC](https://discuss.elastic.co/t/is-it-possible-to-get-stack-trace-info-on-sql-spans-from-ruby-agents/235829/1 "2020-06-04T18:02:08Z")

</div>

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text 🙂

**Kibana version** : 7.6.2

**Elasticsearch version** : 7.6.2

**APM Server version** : 7.6.2

**APM Agent language and version** : Ruby 3.6.0

**Browser version** : Chrome

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:

**Fresh install or upgraded from other version?** : fresh install

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**: I have set up elastic-apm on a rails 5.0 app which seems to be working without many issues. One thing I noticed, however, is that for any SQL or html.erb spans, I simply see "No stack trace available." I've tried adjusting the span\_frames\_min\_duration configuration to enable stacktraces for all spans, but I am only able to see stack traces for AJAX or mongo query spans. I also tried changing a few other configurations such as use\_legacy\_sql\_parser and the source\_lines\_app\_frames settings, but none worked. I was able to find this post: [https://github.com/elastic/kibana/issues/19645](https://github.com/elastic/kibana/issues/19645) which mentions that some agents have limitations in the stack trace info they can send. So I would like to ask, is this a current limitation on the ruby agent? Or is it possible to get stack trace info on all span types including SQL, html.erb rendering, etc.? Thank you.

**Steps to reproduce** :  
1.  
2.  
3.

**Errors in browser console (if relevant)**:

**Provide logs and/or server output (if relevant)**:

---

<div class="post-metadata">

**Author:** ![mikker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikker/32/22118_2.png) [@mikker](https://discuss.elastic.co/u/mikker)\
**Post date:** [June 17, 2020, 1:38pm UTC](https://discuss.elastic.co/t/is-it-possible-to-get-stack-trace-info-on-sql-spans-from-ruby-agents/235829/2 "2020-06-17T13:38:17Z")

</div>

Hi there!

Sadly, because of the way Rails' `ActiveSupport::Notifications` work, it's not possible.

We've tried a few approaches but none successful. We opened an issue with Rails to see if there was interest but it seems not.

> <https://github.com/rails/rails/issues/37565>
>
> I work on the Elastic APM Ruby agent and we subscribe to ActiveSupport::Notifications in order to instrument Rails apps.
> I’m currently trying...

---

<div class="post-metadata">

**Author:** ![adnanrh](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@adnanrh](https://discuss.elastic.co/u/adnanrh)\
**Post date:** [June 30, 2020, 12:12am UTC](https://discuss.elastic.co/t/is-it-possible-to-get-stack-trace-info-on-sql-spans-from-ruby-agents/235829/3 "2020-06-30T00:12:15Z")

</div>

Thanks!

---

<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 20, 2020, 8:12pm UTC](https://discuss.elastic.co/t/is-it-possible-to-get-stack-trace-info-on-sql-spans-from-ruby-agents/235829/4 "2020-07-20T20:12:29Z")

</div>

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