Module: Resque::Plugins::NewRelicInstrumentation

Includes:
NewRelic::Agent::Instrumentation::ControllerInstrumentation
Defined in:
lib/rpm_contrib/instrumentation/resque.rb

Instance Method Summary collapse

Instance Method Details

#around_perform_with_monitoring(*args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rpm_contrib/instrumentation/resque.rb', line 11

def around_perform_with_monitoring(*args)
  begin
    trace_options = if self.name == 'Backgrounded::Handler::ResqueHandler'
      {
        :class_name => args[0],
        :name => args[2].to_s,
        :params => @payload,
        :category => 'OtherTransaction/BackgroundedResqueJob'
      }
    else
      {
        :class_name => self.name,
        :name => 'perform',
        :category => 'OtherTransaction/ResqueJob'
      }
    end
    perform_action_with_newrelic_trace(trace_options) do
      yield(*args)
    end
  ensure
    NewRelic::Agent.save_data if NewRelic::Agent.agent.started?
  end
end