Module: Instana::Instrumentation::ActionControllerLegacy

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

Overview

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActionControllerCommon

#get_render_topic, #has_rails_handler?

Class Method Details

.included(klass) ⇒ Object



120
121
122
123
124
125
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 120

def self.included(klass)
  klass.class_eval do
    alias_method_chain :process_action, :instana
    alias_method_chain :render, :instana
  end
end

Instance Method Details

#process_action_with_instana(*args) ⇒ Object

The Instana wrapper method for ActionController::Base.process_action for versions 3 and 4.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 130

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

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

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

#render_with_instana(*args, &blk) ⇒ Object

The Instana wrapper method for ActionController::Base.render for versions 3 and 4.



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 148

def render_with_instana(*args, &blk)
  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 })
  render_without_instana(*args, &blk)
rescue Exception => e
  ::Instana.tracer.log_error(e) unless has_rails_handler?(e)
  raise
ensure
  ::Instana.tracer.log_exit(:actionview)
end