Module: Instana::Instrumentation::ActionController

Includes:
ActionControllerCommon
Defined in:
lib/instana/frameworks/instrumentation/action_controller.rb

Overview

Used in ActionPack versions 5 and beyond, this module provides instrumentation for ActionController (a part of ActionPack)

Instance Method Summary collapse

Methods included from ActionControllerCommon

#has_rails_handler?

Instance Method Details

#process_action(*args) ⇒ Object

This is the Rails 5 version of the process_action method where we use prepend to instrument the class method instead of using the older alias_method_chain.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 38

def process_action(*args)
  kv_payload = { :actioncontroller => {} }
  kv_payload[:actioncontroller][:controller] = self.class.name
  kv_payload[:actioncontroller][:action] = action_name

  ::Instana.tracer.log_entry(:actioncontroller, kv_payload)

  super(*args)
rescue Exception => e
  ::Instana.tracer.log_error(e) unless has_rails_handler?
  raise
ensure
  ::Instana.tracer.log_exit(:actioncontroller)
end

#render(*args, &blk) ⇒ Object

The Instana wrapper method for ActionController::Base.render for versions 5+.



56
57
58
59
60
61
62
63
64
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 56

def render(*args, &blk)
  ::Instana.tracer.log_entry(:actionview)
  super(*args, &blk)
rescue Exception => e
  ::Instana.tracer.log_error(e) unless has_rails_handler?
  raise
ensure
  ::Instana.tracer.log_exit(:actionview)
end