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

#get_render_topic, #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.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 78

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?(e)
  raise
ensure
  ::Instana.tracer.log_exit(:actioncontroller)
end

#render(*args, &blk) ⇒ Object

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



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 96

def render(*args, &blk)
  # Figure out what's being rendered
  if args.length > 0 && args[0].is_a?(Hash)
    name = get_render_topic(args[0])
  end
  name ||= "Default"

  ::Instana.tracer.log_entry(:actionview, :actionview => { :name => name })

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