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

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 :slight_smile:

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: 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:

Errors in browser console (if relevant):

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

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.