scout_apm_ruby
scout_apm_ruby copied to clipboard
Disable instrumentation on Rails console
Instrumentation seems to be added even when running a production console. I noticed this as the initialization output gets logged there if you log to stdout. Is there a way to prevent this?
We attempt to detect interactive consoles, and won't start the agent in those cases.
Can you run the parts of that line from the console, and see which of those checks is failing. Then version info and gem info (anything console related?) would be helpful.
Those checks appear to work. This happens on Heroku, where logs are sent to stdout. Gem version 3.0.0.pre25
Running rails console on ⬢ myapp... up, run.3700 (Standard-1X)
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Scout Agent [3.0.0.pre25] Initialized
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting ActionController::Base
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting ActionController::Metal
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting ActionController::Api
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting Middleware
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting ActionView::PartialRenderer
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting render_partial
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting render_partial_with_scout_instrument, render_partial_without_scout_instrument
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting collection_with_template
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting collection_with_template_with_scout_instrument, collection_with_template_without_scout_instrument
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting ActionView::TemplateRenderer
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting render_template
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting render_template_with_scout_instrument, render_template_without_scout_instrument
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting ActiveRecord::ConnectionAdapters::AbstractAdapter
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting ActiveRecord::Querying - ActiveRecord::Querying
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting ActiveRecord::Relation#exec_queries - ActiveRecord::Relation (prepending)
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting Net::HTTP
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting Redis
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Instrumenting Grape::Endpoint
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Installed Application Server Integration [null].
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Scout Agent [3.0.0.pre25] Installed
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Agent attempting to load in interactive mode.
[Scout] [12/20/18 09:14:23 +0000 run.3700 (4)] INFO : Deferring agent start. Standing by for first request
Loading production environment (Rails 5.0.7)
irb(main):006:0> defined?(::Rails::Console) && $stdout.isatty && $stdin.isatty
=> true
It looks like the agent isn't starting (correctly), but it is loading instruments. It looks like the check to see if it's an interactive console needs to be moved forward, to earlier in the boot sequence.
If you want to, you can launch rails console with SCOUT_MONITOR=false, which is a stronger way to disable the agent. That should prevent most of those log lines.