Skip to content

Commit

Permalink
Merge branch 'dev' into add_kafka_instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tannalynn committed Aug 23, 2024
2 parents e80579c + 454d61f commit e109579
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# New Relic Ruby Agent Release Notes

## dev
## v9.13.0

Version <dev> enhances support for AWS Lambda functions, adds experimental OpenSearch instrumentation, updates framework detection, fixes Falcon dispatcher detection, fixes a bug with Redis instrumentation installation, and addresses a JRuby specific concurrency issue.
Version 9.13.0 enhances support for AWS Lambda functions, adds experimental OpenSearch instrumentation, updates framework detection, silences a Bundler deprecation warning, fixes Falcon dispatcher detection, fixes a bug with Redis instrumentation installation, and addresses a JRuby-specific concurrency issue.

- **Feature: Enhance AWS Lambda function instrumentation**

Expand All @@ -22,6 +22,10 @@ When utilized via the latest [New Relic Ruby layer for AWS Lambda](https://layer

Previously, applications using the Grape framework would set `ruby` as their framework within the Environment Report. Now, Grape applications will be set to `grape`. Similarly, applications using the Padrino framework would be set to `sinatra`. Now, they will be set to `padrino`. This will help the New Relic security agent compatibility checks. Thank you, [@prateeksen](https://github.com/prateeksen) for making this change. [Issue#2777](https://github.com/newrelic/newrelic-ruby-agent/issues/2777) [PR#2789](https://github.com/newrelic/newrelic-ruby-agent/pull/2789)

- **Feature: Silence Bundler `all_specs` deprecation warning**

`Bundler.rubygems.all_specs` was deprecated in favor of `Bundler.rubygems.installed_specs` in Bundler versions 2+, causing the agent to emit deprecation warnings. The method has been updated when Bundler 2+ is detected and warnings are now silenced. Thanks to [@jcoyne](https://github.com/jcoyne) for reporting this issue. [Issue#2733](https://github.com/newrelic/newrelic-ruby-agent/issues/2733) [PR#2823](https://github.com/newrelic/newrelic-ruby-agent/pull/2823)

- **Bugfix: Fix Falcon dispatcher detection**

Previously, we tried to use the object space to determine whether the [Falcon web server](https://github.com/socketry/falcon) was in use. However, Falcon is not added to the object space until after the environment report is generated, resulting in a `nil` dispatcher. Now, we revert to an earlier strategy that discovered the dispatcher using `File.basename`. Thank you, [@prateeksen](https://github.com/prateeksen) for reporting this issue and researching the problem. [Issue#2778](https://github.com/newrelic/newrelic-ruby-agent/issues/2778) [PR#2795](https://github.com/newrelic/newrelic-ruby-agent/pull/2795)
Expand Down
4 changes: 3 additions & 1 deletion lib/new_relic/agent/instrumentation/grape.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

depends_on do
begin
if defined?(Bundler) && Bundler.rubygems.all_specs.map(&:name).include?('newrelic-grape')
if defined?(Bundler) &&
((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
Expand Down
6 changes: 4 additions & 2 deletions lib/new_relic/control/frameworks/rails4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ class Control
module Frameworks
class Rails4 < NewRelic::Control::Frameworks::Rails3
def rails_gem_list
Bundler.rubygems.all_specs.map do |gem|
"#{gem.name} (#{gem.version})"
if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.0.0')
Bundler.rubygems.installed_specs.map { |gem| "#{gem.name} (#{gem.version})" }
else
Bundler.rubygems.all_specs.map { |gem| "#{gem.name} (#{gem.version})" }
end
end

Expand Down
6 changes: 5 additions & 1 deletion lib/new_relic/environment_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ def self.registered_reporters=(logic)
####################################
report_on('Gems') do
begin
Bundler.rubygems.all_specs.map { |gem| "#{gem.name}(#{gem.version})" }
if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.0.0')
Bundler.rubygems.installed_specs.map { |gem| "#{gem.name}(#{gem.version})" }
else
Bundler.rubygems.all_specs.map { |gem| "#{gem.name}(#{gem.version})" }
end
rescue
# There are certain rubygem, bundler, rails combinations (e.g. gem
# 1.6.2, rails 2.3, bundler 1.2.3) where the code above throws an error
Expand Down
8 changes: 7 additions & 1 deletion lib/new_relic/language_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ def snakeize(string)
end

def bundled_gem?(gem_name)
defined?(Bundler) && Bundler.rubygems.all_specs.map(&:name).include?(gem_name)
return false unless defined?(Bundler)

if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.0.0')
Bundler.rubygems.installed_specs.map(&:name).include?(gem_name)
else
Bundler.rubygems.all_specs.map(&:name).include?(gem_name)
end
rescue => e
::NewRelic::Agent.logger.info("Could not determine if third party #{gem_name} gem is installed", e)
false
Expand Down
2 changes: 1 addition & 1 deletion lib/new_relic/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module NewRelic
module VERSION # :nodoc:
MAJOR = 9
MINOR = 12
MINOR = 13
TINY = 0

STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
Expand Down
10 changes: 10 additions & 0 deletions newrelic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ common: &default_settings
# prepend, chain, disabled.
# instrumentation.net_http: auto

# Controls auto-instrumentation of the opensearch-ruby library at start-up. May
# be one of auto, prepend, chain, disabled.
# instrumentation.opensearch: auto

# Controls auto-instrumentation of Puma::Rack. When enabled, the agent hooks
# into the to_app method in Puma::Rack::Builder to find gems to instrument
# during application startup. May be one of: auto, prepend, chain, disabled.
Expand Down Expand Up @@ -607,6 +611,12 @@ common: &default_settings
# When true, the agent transmits data about your app to the New Relic collector.
# monitor_mode: true

# If true, the agent captures OpenSearch queries in transaction traces.
# opensearch.capture_queries: true

# If true, the agent obfuscates OpenSearch queries in transaction traces.
# opensearch.obfuscate_queries: true

# If true, uses Module#prepend rather than alias_method for ActiveRecord
# instrumentation.
# prepend_active_record_instrumentation: false
Expand Down

0 comments on commit e109579

Please sign in to comment.