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
-
#get_render_topic(opts) ⇒ Object
Render can be called with many options across the various supported versions of Rails.
-
#has_rails_handler? ⇒ Boolean
Indicates whether a Controller rescue handler is in place.
Instance Method Details
#get_render_topic(opts) ⇒ Object
Render can be called with many options across the various supported versions of Rails. This method attempts to make sense and provide insight into what is happening (rendering a layout, file, nothing, plaintext etc.)
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/instana/frameworks/instrumentation/action_controller.rb', line 32 def get_render_topic(opts) if opts.key?(:layout) case opts[:layout] when FalseClass name = "Without layout" when String name = opts[:layout] when Proc name = "Proc" else name = "Default" end end name ||= opts[:template] name ||= opts[:file] name = "Nothing" if opts[:nothing] name = "Plaintext" if opts[:plain] name = "JSON" if opts[:json] name = "XML" if opts[:xml] name = "Raw" if opts[:body] name = "Javascript" if opts[:js] name end |
#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).
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.}" return false end |