Module: Instana::Instrumentation::ActionControllerCommon

Included in:
ActionController, ActionControllerLegacy
Defined in:
lib/instana/frameworks/instrumentation/action_controller.rb

Overview

Contains the methods common to both ::Instana::Instrumentation::ActionController and ::Instana::Instrumentation::ActionControllerLegacy

Instance Method Summary collapse

Instance Method Details

#has_rails_handler?Boolean

Indicates whether a Controller rescue handler is in place. If so, this affects error logging and reporting. (Hence the need for this method).

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 14

def has_rails_handler?
  found = false
  rescue_handlers.detect do |klass_name, _handler|
    # Rescue handlers can be specified as strings or constant names
    klass = self.class.const_get(klass_name) rescue nil
    klass ||= klass_name.constantize rescue nil
    found = exception.is_a?(klass) if klass
  end
  found
rescue => e
  ::Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
  return false
end