Module: FiverunsTuneupMerb::Instrumentation::Merb::Request::Ext

Defined in:
lib/fiveruns_tuneup_merb/instrumentation.rb

Instance Method Summary collapse

Instance Method Details

#dispatch_action(klass, action, *args, &block) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/fiveruns_tuneup_merb/instrumentation.rb', line 110

def dispatch_action(klass, action, *args, &block)
  controller = nil
  @tuneup = Fiveruns::Tuneup.record do
    controller = Fiveruns::Tuneup.step "Dispatching #{klass}##{action}", :controller do
      super
    end
  end
  # Don't save redirects from panel insertion
  if controller && controller.headers['Location']
    ::Merb.logger.debug 'TuneUp: Ignoring redirect.'
    @tuneup = nil
  elsif xml_http_request?
    ::Merb.logger.debug 'TuneUp: Ignoring XHR request.'
    @tuneup = nil
  elsif controller.is_a?(FiverunsTuneupMerb::Application)
    ::Merb.logger.debug 'TuneUp: Ignoring internal request.'
    @tuneup = nil
  else
    ::Merb.logger.info 'TuneUp: Valid request.'
  end   
  controller
end