Sha256: e440c41892790d7bd151e721246c03f1df1073784da600bada8a95bf6fd6c9c3

Contents?: true

Size: 1022 Bytes

Versions: 7

Compression:

Stored size: 1022 Bytes

Contents

# frozen_string_literal: true

require_relative '../patcher'

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

          module_function

          def target_version
            Integration.version
          end

          def patch
            require_relative 'future_patch'
            patch_future
            require_relative 'promises_future_patch'
            patch_promises_future
          end

          # Propagate tracing context in Concurrent::Future
          def patch_future
            ::Concurrent::Future.prepend(FuturePatch) if defined?(::Concurrent::Future)
          end

          # Propagate tracing context in Concurrent::Promises::Future
          def patch_promises_future
            ::Concurrent::Promises.singleton_class.prepend(PromisesFuturePatch) if defined?(::Concurrent::Promises::Future)
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddtrace-1.20.0 lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb
ddtrace-1.19.0 lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb
ddtrace-1.18.0 lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb
ddtrace-1.17.0 lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb
ddtrace-1.16.2 lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb
ddtrace-1.16.1 lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb
ddtrace-1.16.0 lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb