module Instana::Instrumentation::ActionController
Public Instance Methods
process_action(*args)
click to toggle source
Calls superclass method
# File lib/instana/instrumentation/action_controller.rb, line 7 def process_action(*args) call_payload = { actioncontroller: { controller: self.class.name, action: action_name } } request.env['INSTANA_HTTP_PATH_TEMPLATE'] = matched_path_template ::Instana::Tracer.trace(:actioncontroller, call_payload) { super(*args) } end
render(*args, &block)
click to toggle source
Calls superclass method
# File lib/instana/instrumentation/action_controller.rb, line 19 def render(*args, &block) call_payload = { actionview: { name: describe_render_options(args.first) || 'Default' } } ::Instana::Tracer.trace(:actionview, call_payload) { super(*args, &block) } end
Private Instance Methods
describe_direct(options)
click to toggle source
# File lib/instana/instrumentation/action_controller.rb, line 62 def describe_direct(options) case options when ->(o) { o.key?(:nothing) } 'Nothing' when ->(o) { o.key?(:plain) } 'Plaintext' when ->(o) { o.key?(:json) } 'JSON' when ->(o) { o.key?(:xml) } 'XML' when ->(o) { o.key?(:body) } 'Raw' when ->(o) { o.key?(:js) } 'Javascript' when ->(o) { o.key?(:template) } options[:template] when ->(o) { o.key?(:file) } options[:file] end end
describe_layout(layout)
click to toggle source
# File lib/instana/instrumentation/action_controller.rb, line 47 def describe_layout(layout) return unless layout case layout when FalseClass 'Without layout' when String layout when Proc 'Proc' else 'Default' end end
describe_render_options(options)
click to toggle source
# File lib/instana/instrumentation/action_controller.rb, line 40 def describe_render_options(options) return unless options.is_a?(Hash) describe_layout(options[:layout]) || describe_direct(options) end
matched_path_template()
click to toggle source
# File lib/instana/instrumentation/action_controller.rb, line 31 def matched_path_template Rails.application.routes.router.recognize(request) do |route, _, _| path = route.path return path.spec.to_s end nil end