class Datadog::Contrib::ConcurrentRuby::ContextCompositeExecutorService
wraps existing executor to carry over trace context
Attributes
composited_executor[RW]
Public Class Methods
new(composited_executor)
click to toggle source
# File lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb, line 13 def initialize(composited_executor) @composited_executor = composited_executor end
Public Instance Methods
datadog_configuration()
click to toggle source
# File lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb, line 33 def datadog_configuration Datadog.configuration[:concurrent_ruby] end
post(*args) { || ... }
click to toggle source
post method runs the task within composited executor - in a different thread
# File lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb, line 18 def post(*args, &task) parent_context = datadog_configuration.tracer.provider.context @composited_executor.post(*args) do begin original_context = datadog_configuration.tracer.provider.context datadog_configuration.tracer.provider.context = parent_context yield ensure # Restore context in case the current thread gets reused datadog_configuration.tracer.provider.context = original_context end end end