Sha256: 21c4f13b994a6f6cc5437aefb0898423fe6cd6c2f5e32462bcc1896934345e43

Contents?: true

Size: 1.44 KB

Versions: 8

Compression:

Stored size: 1.44 KB

Contents

module Datadog
  # TODO: Remove me!
  # Monkey was used for monkey-patching 3rd party libs.
  # It is now DEPRECATED. This API is no-op, and serves only to warn
  # of its deactivation.
  module Monkey
    @registry = Datadog.registry

    DEPRECATION_WARNING = %(
      Datadog::Monkey has been REMOVED as of version 0.11.1.
      All calls to Datadog::Monkey are no-ops.
      *Implementations using Monkey will no longer function*.
      Upgrade to the new configuration API using the migration guide here:
      https://github.com/DataDog/dd-trace-rb/releases/tag/v0.11.0).freeze

    module_function

    def registry
      log_deprecation_warning('Monkey#registry')
      @registry
    end

    def autopatch_modules
      log_deprecation_warning('Monkey#autopatch_modules')
      {}
    end

    def patch_all
      log_deprecation_warning('Monkey#patch_all')
    end

    def patch_module(m)
      log_deprecation_warning('Monkey#patch_module')
    end

    def patch(modules)
      log_deprecation_warning('Monkey#patch')
    end

    def get_patched_modules
      log_deprecation_warning('Monkey#get_patched_modules')
      {}
    end

    def without_warnings(&block)
      log_deprecation_warning('Monkey#without_warnings')
      Datadog::Patcher.without_warnings(&block)
    end

    def log_deprecation_warning(method)
      Datadog::Logger.log.warn("#{method}:#{DEPRECATION_WARNING}")
    end

    class << self
      attr_writer :registry
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ddtrace-0.34.2 lib/ddtrace/monkey.rb
ddtrace-0.34.1 lib/ddtrace/monkey.rb
ddtrace-0.34.0 lib/ddtrace/monkey.rb
ddtrace-0.33.1 lib/ddtrace/monkey.rb
ddtrace-0.33.0 lib/ddtrace/monkey.rb
ddtrace-0.32.0 lib/ddtrace/monkey.rb
ddtrace-0.31.1 lib/ddtrace/monkey.rb
ddtrace-0.31.0 lib/ddtrace/monkey.rb