Skip to content

Commit

Permalink
Merge pull request #1129 from newrelic/870-release-touchups
Browse files Browse the repository at this point in the history
Deprecate Ruby 2.2 and Rails 3.2
  • Loading branch information
kaylareopelle committed May 2, 2022
2 parents a4ef94b + d553510 commit bfcee4e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

We'd like to thank @mikeantonelli for sharing a gist with us that provided our team with an entry point for this feature.

* **Deprecate support for Ruby 2.2**

Ruby 2.2 reached end of life on March 31, 2018. The agent has deprecated support for Ruby 2.2 and will make breaking changes for this version in its next major release.

* **Deprecate instrumentation versions with low adoption and/or versions over five years old**

This release deprecates the following instrumentation:
Expand All @@ -39,6 +43,7 @@
| Passenger < 5.1.3 | Passenger >= 5.1.3 |
| Puma < 3.9.0 | Puma >= 3.9.0 |
| Rack < 1.6.8 | Rack >= 1.6.8 |
| Rails 3.2.x | Rails >= 4.x |
| Rainbows (all versions) | none |
| Sequel < 4.45.0 | Sequel >= 4.45.0 |
| Sidekiq < 5.0.0 | Sidekiq >= 5.0.0 |
Expand All @@ -57,6 +62,10 @@
We thank @robotfelix for suggesting these changes.

* **Internally leverage `Object.const_get` and `Object.const_defined?`**

When dynamically checking for or obtaining a handle to a class constant from a string, leverage the `Object` class's built in methods wherever possible to enjoy simpler, more performant operations. All JRubies and CRubies v2.5 and below need a bit of assistance beyond what `Object` can provide given that those Rubies may yield an unwanted constant from a different namespace than the one that was specified. But for all other Rubies and even for those Rubies in contexts where we can 100% trust the string value coming in, leverage the `Object` class's methods and reap the benefits.

* **Enable Environment Variables setting Array configurations to be converted to Arrays**

Prior to this change, when comma-separated lists were passed as environment variables, an error would be emitted to the `newrelic_agent.log` and a String would be set as the value. Now, Arrays will be accurately coerced.
Expand Down
31 changes: 31 additions & 0 deletions lib/new_relic/control/instrumentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,40 @@ def _install_instrumentation
File.join(instrumentation_path, app.to_s, '*.rb')
@instrumentation_files.each { |pattern| load_instrumentation_files pattern }
DependencyDetection.detect!
ruby_22_deprecation
rails_32_deprecation
::NewRelic::Agent.logger.info "Finished instrumentation"
end
end

def rails_32_deprecation
return unless defined?(Rails::VERSION) && Gem::Version.new(Rails::VERSION::STRING) <= Gem::Version.new('3.2')
deprecation_msg = 'The Ruby Agent is dropping support for Rails 3.2 ' \
'in a future major release. Please upgrade your Rails version to continue receiving support. ' \

Agent.logger.log_once(
:warn,
:deprecated_rails_version,
deprecation_msg
)

::NewRelic::Agent.record_metric("Supportability/Deprecated/Rails32", 1)
end

def ruby_22_deprecation
return unless RUBY_VERSION <= '2.2.0'
deprecation_msg = 'The Ruby Agent is dropping support for Ruby 2.2 ' \
'in version 9.0.0. Please upgrade your Ruby version to continue receiving support. ' \

::NewRelic::Agent.logger.log_once(
:warn,
:deprecated_ruby_version,
deprecation_msg
)

::NewRelic::Agent.record_metric("Supportability/Deprecated/Ruby22", 1)
end

include Instrumentation
end
end

0 comments on commit bfcee4e

Please sign in to comment.