Sha256: e2cea0e37ac1f8df0dd5cb6067ef6422d0034ef516289d7b90c02c7f9ce750e8

Contents?: true

Size: 754 Bytes

Versions: 4

Compression:

Stored size: 754 Bytes

Contents

require 'ddtrace/contrib/patcher'

module Datadog
  module Contrib
    module ConcurrentRuby
      # Patcher enables patching of 'Future' class.
      module Patcher
        include Contrib::Patcher

        module_function

        def patched?
          done?(:concurrent_ruby)
        end

        def patch
          do_once(:concurrent_ruby) do
            begin
              require 'ddtrace/contrib/concurrent_ruby/future_patch'

              patch_future
            rescue StandardError => e
              Datadog::Tracer.log.error("Unable to apply Future integration: #{e}")
            end
          end
        end

        def patch_future
          ::Concurrent::Future.send(:include, FuturePatch)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ddtrace-0.16.1 lib/ddtrace/contrib/concurrent_ruby/patcher.rb
ddtrace-0.15.0.internaltracinfeature1 lib/ddtrace/contrib/concurrent_ruby/patcher.rb
ddtrace-0.16.0 lib/ddtrace/contrib/concurrent_ruby/patcher.rb
ddtrace-0.15.0 lib/ddtrace/contrib/concurrent_ruby/patcher.rb