Module: NewRelic::Agent::Instrumentation::MonitoredThread::Chain

Defined in:
lib/new_relic/agent/instrumentation/thread/chain.rb

Class Method Summary collapse

Class Method Details

.instrument!Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/new_relic/agent/instrumentation/thread/chain.rb', line 10

def self.instrument!
  ::Thread.class_eval do
    include NewRelic::Agent::Instrumentation::MonitoredThread

    alias_method(:initialize_without_new_relic, :initialize)

    def initialize(*args, &block)
      traced_block = add_thread_tracing(&block)
      initialize_with_newrelic_tracing { initialize_without_new_relic(*args, &traced_block) }
    end
  end
end