Module: NewRelic::Agent::Instrumentation::Resque

Includes:
ControllerInstrumentation
Included in:
Prepend
Defined in:
lib/new_relic/agent/instrumentation/resque/chain.rb,
lib/new_relic/agent/instrumentation/resque/helper.rb,
lib/new_relic/agent/instrumentation/resque/prepend.rb,
lib/new_relic/agent/instrumentation/resque/instrumentation.rb

Defined Under Namespace

Modules: Chain, Helper, Prepend

Constant Summary collapse

INSTRUMENTATION_NAME =
NewRelic::Agent.base_name(name)

Constants included from ControllerInstrumentation

ControllerInstrumentation::NR_DEFAULT_OPTIONS, ControllerInstrumentation::NR_DO_NOT_TRACE_KEY, ControllerInstrumentation::NR_IGNORE_APDEX_KEY, ControllerInstrumentation::NR_IGNORE_ENDUSER_KEY

Instance Method Summary collapse

Methods included from ControllerInstrumentation

included, #perform_action_with_newrelic_trace

Methods included from ControllerInstrumentation::ClassMethods

#add_transaction_tracer, #already_added_transaction_tracer?, #build_method_names, #generate_argument_list, #newrelic_ignore, #newrelic_ignore_apdex, #newrelic_ignore_aspect, #newrelic_ignore_enduser, #newrelic_read_attr, #newrelic_write_attr, #parse_punctuation

Instance Method Details

#with_tracingObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 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