Module: NewRelic::Agent::Instrumentation::Parallel::Prepend

Includes:
Instrumentation
Defined in:
lib/new_relic/agent/instrumentation/parallel/prepend.rb

Instance Method Summary collapse

Methods included from Instrumentation

#setup_for_txn_metric_merge_at_exit, #worker_with_tracing

Instance Method Details

#worker(job_factory, options, &block) ⇒ Object



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

def worker(job_factory, options, &block)
  return super unless NewRelic::Agent.agent

  # Make sure the pipe channel listener is actually listening
  NewRelic::Agent::PipeChannelManager.listener.start unless NewRelic::Agent::PipeChannelManager.listener.started?

  # Create a unique id for the channel and register it
  channel_id = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
  NewRelic::Agent.register_report_channel(channel_id)

  super do |*args|
    worker_with_tracing(channel_id) { yield(*args) }
  end
end