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.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 66

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+.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 84

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