Sha256: bb8ab9b2ae790735c874c7048abbf65cd9a462a9f50e84d63d0d8423e533384f

Contents?: true

Size: 977 Bytes

Versions: 48

Compression:

Stored size: 977 Bytes

Contents

require 'concurrent/executor/executor_service'

module Datadog
  module Contrib
    module ConcurrentRuby
      # wraps existing executor to carry over trace context
      class ContextCompositeExecutorService
        extend Forwardable
        include Concurrent::ExecutorService

        attr_accessor :composited_executor

        def initialize(composited_executor)
          @composited_executor = composited_executor
        end

        # post method runs the task within composited executor - in a different thread
        def post(*args, &task)
          context = datadog_configuration.tracer.provider.context

          @composited_executor.post(*args) do
            datadog_configuration.tracer.provider.context = context
            yield
          end
        end

        def datadog_configuration
          Datadog.configuration[:concurrent_ruby]
        end

        delegate [:can_overflow?, :serialized?] => :composited_executor
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
ddtrace-0.36.0 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ls-trace-0.1.2 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.35.2 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.35.1 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.35.0 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.34.2 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.34.1 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.34.0 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.33.1 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.33.0 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.32.0 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.31.1 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.31.0 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.30.1 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.30.0 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.29.1 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.26.1 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ls-trace-0.1.1 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.29.0 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb
ddtrace-0.28.0 lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb