Sha256: af5de689fd39c4bc4194f66a13f014e7b8603b0cf638b3c9d608c60e8c46d198

Contents?: true

Size: 770 Bytes

Versions: 4

Compression:

Stored size: 770 Bytes

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

module NewRelic
  module Agent
    module Instrumentation
      module MonitoredThread
        attr_reader :nr_parent_thread_id

        def initialize_with_newrelic_tracing
          @nr_parent_thread_id = ::Thread.current.object_id
          yield
        end

        def add_thread_tracing(*args, &block)
          return block if skip_tracing?

          NewRelic::Agent::Tracer.thread_block_with_current_transaction(*args, &block)
        end

        def skip_tracing?
          !NewRelic::Agent.config[:'instrumentation.thread.tracing']
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_rpm-8.14.0 lib/new_relic/agent/instrumentation/thread/instrumentation.rb
newrelic_rpm-8.13.1 lib/new_relic/agent/instrumentation/thread/instrumentation.rb
newrelic_rpm-8.13.0 lib/new_relic/agent/instrumentation/thread/instrumentation.rb
newrelic_rpm-8.12.0 lib/new_relic/agent/instrumentation/thread/instrumentation.rb