Sha256: 627c9c6a9d36667983600223646b0c9eecbfefe350ce5add1ae6be24c0c2bbe7

Contents?: true

Size: 779 Bytes

Versions: 5

Compression:

Stored size: 779 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_key

        def initialize_with_newrelic_tracing
          @nr_parent_key = NewRelic::Agent::Tracer.current_segment_key
          yield
        end

        def add_thread_tracing(*args, &block)
          return block if !NewRelic::Agent::Tracer.thread_tracing_enabled?

          NewRelic::Agent::Tracer.thread_block_with_current_transaction(
            *args,
            segment_name: 'Ruby/Thread',
            &block
          )
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
newrelic_rpm-9.2.2 lib/new_relic/agent/instrumentation/thread/instrumentation.rb
newrelic_rpm-9.2.1 lib/new_relic/agent/instrumentation/thread/instrumentation.rb
newrelic_rpm-9.2.0 lib/new_relic/agent/instrumentation/thread/instrumentation.rb
newrelic_rpm-9.1.0 lib/new_relic/agent/instrumentation/thread/instrumentation.rb
newrelic_rpm-9.0.0 lib/new_relic/agent/instrumentation/thread/instrumentation.rb