Sha256: 7613d506add0d2019546df7f7aa43e7ae4e3188d2945602a29cf2988dae80400

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module Instrumentation
    module ConcurrentRuby
      module Patches
        # Concurrent::ThreadPoolExecutor patch for instrumentation
        module ThreadPoolExecutor
          # @see Concurrent::ExecutorService#post
          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
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-concurrent_ruby-0.21.4 lib/opentelemetry/instrumentation/concurrent_ruby/patches/thread_pool_executor.rb
opentelemetry-instrumentation-concurrent_ruby-0.21.3 lib/opentelemetry/instrumentation/concurrent_ruby/patches/thread_pool_executor.rb
opentelemetry-instrumentation-concurrent_ruby-0.21.2 lib/opentelemetry/instrumentation/concurrent_ruby/patches/thread_pool_executor.rb