Module: Datadog::Contrib::ConcurrentRuby::Patcher

Includes:
Patcher
Defined in:
lib/ddtrace/contrib/concurrent_ruby/patcher.rb

Overview

Patcher enables patching of ‘Future’ class.

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.patchObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ddtrace/contrib/concurrent_ruby/patcher.rb', line 16

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

.patch_futureObject

Propagate tracing context in Concurrent::Future



29
30
31
# File 'lib/ddtrace/contrib/concurrent_ruby/patcher.rb', line 29

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

.patched?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/ddtrace/contrib/concurrent_ruby/patcher.rb', line 12

def patched?
  done?(:concurrent_ruby)
end