-
Notifications
You must be signed in to change notification settings - Fork 107
Description
We faced an issue in which scout agent will start and worker thread will get initialized when running bundle exec rails console.
I inspected the code that does the checks and I believe that method interactive? in lib/scout_apm/environment.rb is the one doing so
# If both stdin & stdout are interactive and the Rails::Console constant is defined
def interactive?
defined?(::Rails::Console) && $stdout.isatty && $stdin.isatty
endI did some debugging and discovered that in later versions of rails (6 or higher) where spring is used to load the app, ::Rails::Console can become undefined. Of course this causes the method above to return false, hence the agent gets initialized.
I searched for a fix and stumbled upon this thread in another project, but discussing the same issue.
A workaround is to disable spring using export DISABLE_SPRING=true before running rails console
I just wanted to share this info, also maybe if there is a way to detect if spring is working and add a condition to the method above.
Version info:
ruby '3.2.1'
'rails', '~> 7.0.4.3'
'scout_apm', ''5.3.5'