Skip to content

Make Rails SQL backtrace work again in test and development

Stan Hu requested to merge sh-fix-rails-database-log-subscriber into master

What does this MR do and why?

!145084 (merged) made it possible to see the full backtrace when the error occurred inside a gem, but in development and test this made the Rails SQL backtrace logger show this line in the logs:

-> activerecord (7.0.8.1) lib/active_record/log_subscriber.rb:131:in `debug'

This change assigns the ActiveRecord::LogSubscriber remove any backtraces not associated with the GitLab application.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Check out this branch.
  2. Watch tail -f log/development.log for SQL queries.
Edited by Stan Hu

Merge request reports