Closed jshah closed 3 years ago
👋 @jshah, thank you for this report.
Could you let us know how you are including/requiring the ddtrace
in your project? (the relevant Gemfile line and require
statement)
This will help us guide you on how to avoid these messages in development, as the way you require
the gem affects how it starts up.
Hi @marcotc!
We are requiring the gem as following in no specific group. Should we be requiring only in the :production
group?
gem "ddtrace", "~> 0.45.0", require: 'ddtrace/auto_instrument'
Ah, I just grasped that auto_instrument
will automatically turn on tracing. Do you know what services auto_instrument
runs by default?
auto_instrument
will instrument every gem available in your application. It will also kick off all tracer internals, including the part that prints ddtrace: [ddtrace] DATADOG TRACER...
.
I suggest removing , require: 'ddtrace/auto_instrument'
from your Gemfile and adding that require statement here:
if ENV['ENABLE_DATADOG'] && Rails.env.production? && !defined?(Rails::Console)
require: 'ddtrace/auto_instrument'
Datadog.configure do |c|
c.tracer hostname: open('http://169.254.169.254/latest/meta-data/local-ipv4',
{ read_timeout: 3, open_timeout: 3 }).read
end
end
Unless you are directly interacting with the gem (e.g. making calls to Datadog. ...
), you can even do away with the else block above.
If you are directly interacting with it, then add require 'ddtrace'
to the else block. This won't do anything, except for loading classes.
Thanks, this makes sense. Closing issue 🙂
We're using
ddtrace
0.45.0
and we're controlling tracer as such:We also use the https://github.com/grosser/parallel_tests gem and when running
RAILS_ENV=test bundle exec rails parallel:setup
, I always see this output from ddtrace:I'm not sure if this is specific to the gem but it wasn't happening before
ddtrace
was installed