Module: OpenTelemetry::Instrumentation::ConcurrentRuby::Patches::ThreadPoolExecutor

Defined in:
lib/opentelemetry/instrumentation/concurrent_ruby/patches/thread_pool_executor.rb

Overview

Concurrent::ThreadPoolExecutor patch for instrumentation

Instance Method Summary collapse

Instance Method Details

#post(*args, **kwargs, &task) ⇒ Object

See Also:

  • Concurrent::ExecutorService#post


14
15
16
17
18
19
20
21
22
23
# File 'lib/opentelemetry/instrumentation/concurrent_ruby/patches/thread_pool_executor.rb', line 14

def post(*args, **kwargs, &task)
  context = OpenTelemetry::Context.current
  return super unless context

  super(*args, **kwargs) do
    OpenTelemetry::Context.with_current(context) do
      yield(*args, **kwargs)
    end
  end
end