Module: TraceView::Inst::ActionControllerAPI

Includes:
RailsBase
Defined in:
lib/traceview/frameworks/rails/inst/action_controller_api.rb

Overview

ActionController

This modules contains the instrumentation code specific to Rails v5.

Instance Method Summary collapse

Methods included from RailsBase

#has_handler?, #log_rails_error?, #render_with_traceview

Instance Method Details

#process_action(method_name, *args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/traceview/frameworks/rails/inst/action_controller_api.rb', line 15

def process_action(method_name, *args)
  kvs = {
    :Controller   => self.class.name,
    :Action       => self.action_name,
  }
  kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:action_controller_api][:collect_backtraces]

  TraceView::API.log_entry('rails-api', kvs)
  super(method_name, *args)

rescue Exception => e
  TraceView::API.log_exception(nil, e) if log_rails_error?(e)
  raise
ensure
  TraceView::API.log_exit('rails-api')
end

#render(*args, &blk) ⇒ Object

render

Our render wrapper that just times and conditionally reports raised exceptions



38
39
40
41
42
43
44
45
46
47
# File 'lib/traceview/frameworks/rails/inst/action_controller_api.rb', line 38

def render(*args, &blk)
  TraceView::API.log_entry('actionview')
  super(*args, &blk)

rescue Exception => e
  TraceView::API.log_exception(nil, e) if log_rails_error?(e)
  raise
ensure
  TraceView::API.log_exit('actionview')
end