Method: NewRelic::TracedThread#initialize

Defined in:
lib/new_relic/traced_thread.rb

#initialize(*args, &block) ⇒ TracedThread

Creates a new Thread whose work will be traced by New Relic. Use this class as a replacement for the native Thread class. Example: Instead of using Thread.new, use:

NewRelic::TracedThread.new { execute_some_code }

23
24
25
26
27
# File 'lib/new_relic/traced_thread.rb', line 23

def initialize(*args, &block)
  NewRelic::Agent.record_api_supportability_metric(:traced_thread)
  traced_block = create_traced_block(&block)
  super(*args, &traced_block)
end