Sha256: 62b041b7dd89fad9e60e0dd7c152a2f24adcb5b9a9ec649a7b558e51eceaee99

Contents?: true

Size: 847 Bytes

Versions: 2

Compression:

Stored size: 847 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,
            segment_name: 'Ruby/Thread',
            &block
          )
        end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_rpm-8.16.0 lib/new_relic/agent/instrumentation/thread/instrumentation.rb
newrelic_rpm-8.15.0 lib/new_relic/agent/instrumentation/thread/instrumentation.rb