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



108
109
110
111
112
113
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 108

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.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 118

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



136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 136

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