Skip to content

Remove Ruby 2.0-specific code paths#1503

Merged
marcotc merged 1 commit into
masterfrom
deprecate-ruby-2.0-remove-code
May 18, 2021
Merged

Remove Ruby 2.0-specific code paths#1503
marcotc merged 1 commit into
masterfrom
deprecate-ruby-2.0-remove-code

Conversation

@marcotc

@marcotc marcotc commented May 17, 2021

Copy link
Copy Markdown
Member

This PR removes code paths that only existed to handle Ruby 2.0 execution.

The two main non-trivial changes are:

  • OpenTracer requires Ruby 2.1+, thus support for it is now unconditional.
  • The profiler requires Ruby 2.1+, thus support for it is now unconditional.

Some nested conditional paths have been removed, thus I recommend reviewing this PR with "Hide whitespace changes": https://github.com/DataDog/dd-trace-rb/pull/1503/files&w=1.

This PR does not update existing code paths to use 2.1+-only features: that work will be performed in a separate PR.

Ruby 2.0 deprecation checklist

  • Remove 2.0 from CI
  • Remove 2.0-specific code paths
  • Update to 2.1+ standards: https://github.com/ruby/ruby/blob/v2_1_0/NEWS
    • Exception#cause
    • Array#to_h converts an array of key-value pairs into a Hash.
    • Kernel#singleton_method
    • Process.clock_gettime
    • Enumerable#to_h converts a list of key-value pairs into a Hash.
    • Now the default values of keyword arguments can be omitted. Those “required keyword arguments” need giving explicitly at the call time.
    • Module#include and Module#prepend are now public methods.
  • Update documentation

@marcotc marcotc added the deprecation Involves a deprecation label May 17, 2021
@marcotc marcotc self-assigned this May 17, 2021
@marcotc
marcotc requested a review from a team May 17, 2021 23:35

@ivoanjo ivoanjo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Big thanks for doing this :)

/me looks at 2.1: you're next!

Comment thread lib/ddtrace/opentracer.rb
Comment on lines 20 to 22
module Datadog
# Namespace for ddtrace OpenTracing implementation
module OpenTracer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm: This file assumes that opentracing is available when it gets required. Is that because it never gets required automatically, e.g. it's up to customers to add require 'ddtrace/opentracer'?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread lib/ddtrace/profiling.rb
Comment on lines 20 to 23
def self.ruby_engine_unsupported?
'JRuby is not supported' if RUBY_ENGINE == 'jruby'
end
private_class_method :ruby_engine_unsupported?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: I'll do a few post-2.0 cleanups as well, but we can finally use do private_class_method def ... and avoid having to retype the method name afterwards! :) :) :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@marcotc
marcotc merged commit 813a3ce into master May 18, 2021
@marcotc
marcotc deleted the deprecate-ruby-2.0-remove-code branch May 18, 2021 18:29
@github-actions github-actions Bot added this to the 0.50.0 milestone May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecation Involves a deprecation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants