Looks like https://github.com/DataDog/dd-trace-rb/commit/32f512a892fa80d2c8106c27b7aba36c4cc4b481 broke our deployment. Version 0.32.0 works fine. This is with rails 6.0.2.1 and ruby 2.6.5. Let me know if you need more info.
01 NoMethodError: undefined method `>=' for nil:NilClass
01 /home/deploy/apps/twentybn/shared/bundle/ruby/2.6.0/gems/ddtrace-0.33.0/lib/ddtrace/contrib/rails/integration.rb:23:in `compatible?'
01 /home/deploy/apps/twentybn/shared/bundle/ruby/2.6.0/gems/ddtrace-0.33.0/lib/ddtrace/contrib/patchable.rb:47:in `patch'
01 /home/deploy/apps/twentybn/shared/bundle/ruby/2.6.0/gems/ddtrace-0.33.0/lib/ddtrace/contrib/extensions.rb:46:in `use'
01 /home/deploy/apps/twentybn/releases/20200306091807/config/initializers/datadog.rb:17:in `block in <main>'
01 /home/deploy/apps/twentybn/shared/bundle/ruby/2.6.0/gems/ddtrace-0.33.0/lib/ddtrace/configuration.rb:15:in `configure'
01 /home/deploy/apps/twentybn/releases/20200306091807/config/initializers/datadog.rb:10:in `<main>'
Hello,
I've managed to narrow it down to this specific tracer:
c.use :rest_client, split_by_domain: true
If we stop using the rest_client tracer, our deploys work. So something would suggest that the rest_client code is somehow assuming version will return a Rails version but it isn't.
Turns out we do not have the rest_client gem in our project anymore and forgot to remove the configuration option in DataDog. That's most likely what's causing the issue. However I would expect the client not to blow up but just ignore that configuration option, or throw a warning if the ::RestClient::Request constant is not defined, rather than blowing up.
Hope that helps.
We are running into the same error, but with AWS. In our DataDog config we do have c.use :aws along with other services.
NoMethodError: undefined method `>=' for nil:NilClass
/usr/local/bundle/gems/ddtrace-0.33.0/lib/ddtrace/contrib/aws/integration.rb:27:in `compatible?'
/usr/local/bundle/gems/ddtrace-0.33.0/lib/ddtrace/contrib/patchable.rb:47:in `patch'
/usr/local/bundle/gems/ddtrace-0.33.0/lib/ddtrace/contrib/extensions.rb:46:in `use'
/deploy/config/initializers/datadog.rb:14:in `block in <top (required)>'
/usr/local/bundle/gems/ddtrace-0.33.0/lib/ddtrace/configuration.rb:15:in `configure'
/deploy/config/initializers/datadog.rb:5:in `<top (required)>'
/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:319:in `load'
/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:319:in `block in load'
/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:319:in `load'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:667:in `block in load_config_initializer'
/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications.rb:182:in `instrument'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:666:in `load_config_initializer'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:624:in `block (2 levels) in <class:Engine>'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:623:in `each'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:623:in `block in <class:Engine>'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `run'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:50:in `each'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:50:in `tsort_each_child'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:363:in `initialize!'
/deploy/config/environment.rb:5:in `<top (required)>'
/usr/local/bundle/gems/zeitwerk-2.2.2/lib/zeitwerk/kernel.rb:23:in `require'
/usr/local/bundle/gems/zeitwerk-2.2.2/lib/zeitwerk/kernel.rb:23:in `require'
/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:339:in `require_environment!'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:515:in `block in run_tasks_blocks'
/usr/local/bundle/gems/bugsnag-6.13.0/lib/bugsnag/integrations/rake.rb:19:in `execute'
/usr/local/bundle/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
/usr/local/bundle/gems/bugsnag-6.13.0/lib/bugsnag/integrations/rake.rb:19:in `execute'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/command.rb:48:in `invoke'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
The common thread between both of these errors is that the version is likely resolving to nil:
class Integration
include Contrib::Integration
register_as :rest_client
def self.version
Gem.loaded_specs['rest-client'] && Gem.loaded_specs['rest-client'].version
end
# ...
def self.compatible?
super && version >= Gem::Version.new('1.8')
end
end
I suspect version is nil because the gems aren't loaded when use is invoked. Are these gems actually loaded and available?
Either way, even if you activated an integration that wasn't available, it shouldn't raise an error like this... something we'll address.
I'm working on a fix for this, and adding additional unit test coverage to prevent any errors like this again. My current expectation is to have a patch for this released early next week.
Okay made a PR which I think should fix the problem: #966
@roccoblues @brafales @javierjulio can you test out the branch and confirm it fixes the issue for you?
Okay made a PR which I think should fix the problem: #966
@roccoblues @brafales @javierjulio can you test out the branch and confirm it fixes the issue for you?
Hi. Thanks for fixing so quickly. It does fix it for rest_client integration.
Okay, great, we'll try to get a bugfix released soon. Thanks for helping figure this one out!