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