Module: AppPerfRpm::Instruments::ActionController

Defined in:
lib/app_perf_rpm/instruments/action_controller.rb

Instance Method Summary collapse

Instance Method Details

#perform_action_with_trace(*arguments) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/app_perf_rpm/instruments/action_controller.rb', line 29

def perform_action_with_trace(*arguments)
  if ::AppPerfRpm::Tracer.tracing?
    operation = "#{@_request.path_parameters['controller']}##{@_request.path_parameters['action']}"
    span = AppPerfRpm.tracer.start_span(operation, tags: {
      "component" => "ActionController",
      "span.kind" => "client"
    })
    AppPerfRpm::Utils.log_source_and_backtrace(span, :action_controller)
  end
  perform_action_without_trace(*arguments)
rescue Exception => e
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end

#process_action_with_trace(method_name, *args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/app_perf_rpm/instruments/action_controller.rb', line 6

def process_action_with_trace(method_name, *args)
  if ::AppPerfRpm::Tracer.tracing?
    operation = "#{self.class.name}##{self.action_name}"
    span = AppPerfRpm.tracer.start_span(operation, tags: {
      "component" => "ActionController",
      "span.kind" => "client"
    })
    AppPerfRpm::Utils.log_source_and_backtrace(span, :action_controller)
  end

  process_action_without_trace(method_name, *args)
rescue Exception => e
  puts e.message.inspect
  puts e.backtrace.join("\n")
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end