Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backtrace to ActiveRecord SQL queries #1416

Open
pokonski opened this issue Sep 12, 2023 · 1 comment
Open

Add backtrace to ActiveRecord SQL queries #1416

pokonski opened this issue Sep 12, 2023 · 1 comment

Comments

@pokonski
Copy link

pokonski commented Sep 12, 2023

Is your feature request related to a problem? Please describe.

Currently Ruby agent does not submit backtraces for the SQL queries coming from Rails apps.

Describe the solution you'd like

Add backtraces to SQL queries so they are visible in Elastic APM UI.

Original request to Rails is here rails/rails#37565 by @estolfo, but at that time it was not possible.

This is now possible using ActiveSupport::LogSubscriber where caller is available and returns proper backtrace with application sources.

ActiveRecord::LogSubscriber already does it to print out the line the query was called from. But full backtrace is also available, see how Rails does it here: https://github.com/rails/rails/blob/7-0-stable/activerecord/lib/active_record/log_subscriber.rb#L136

Describe alternatives you've considered

No alternatives

Additional context

@estolfo
Copy link
Contributor

estolfo commented Sep 13, 2023

thanks for letting us know about this update in ActiveRecord, @pokonski! We'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants