diff --git a/lib/new_relic/agent/instrumentation/grape.rb b/lib/new_relic/agent/instrumentation/grape.rb index 0e658e02c5..0c72352c8e 100644 --- a/lib/new_relic/agent/instrumentation/grape.rb +++ b/lib/new_relic/agent/instrumentation/grape.rb @@ -19,8 +19,10 @@ depends_on do begin - if defined?(Bundler) && ((Bundler::VERSION >= '2' && Bundler.rubygems.installed_specs.map(&:name).include?('newrelic-grape')) || - Bundler.rubygems.all_specs.map(&:name).include?('newrelic-grape')) + return unless defined?(Bundler) + + if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.0.0') && Bundler.rubygems.installed_specs.map(&:name).include?('newrelic-grape') || + Bundler.rubygems.all_specs.map(&:name).include?('newrelic-grape') NewRelic::Agent.logger.info('Not installing New Relic supported Grape instrumentation because the third party newrelic-grape gem is present') false else