module NewRelic::Agent::Instrumentation::Resque

Constants

INSTRUMENTATION_NAME

Public Instance Methods

with_tracing() { || ... } click to toggle source
# File lib/new_relic/agent/instrumentation/resque/instrumentation.rb, line 11
def with_tracing
  NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)

  begin
    perform_action_with_newrelic_trace(
      :name => 'perform',
      :class_name => self.payload_class,
      :category => 'OtherTransaction/ResqueJob'
    ) do
      NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(
        args,
        :'job.resque.args',
        NewRelic::Agent::AttributeFilter::DST_NONE
      )

      yield
    end
  ensure
    # Stopping the event loop before flushing the pipe.
    # The goal is to avoid conflict during write.
    if NewRelic::Agent::Instrumentation::Resque::Helper.resque_fork_per_job?
      NewRelic::Agent.agent.stop_event_loop
      NewRelic::Agent.agent.flush_pipe_data
    end
  end
end