Sha256: 71ef1dab1df5f352ead23be6582fdd77bd42cd313c650e243d85c705afbe0361
Contents?: true
Size: 1.43 KB
Versions: 20
Compression:
Stored size: 1.43 KB
Contents
module ScoutApm module Instruments # instrumentation for Rails 3 and Rails 4 is the same. class ActionView attr_reader :logger def initalize(logger=ScoutApm::Agent.instance.logger) @logger = logger @installed = false end def installed? @installed end def install @installed = true if defined?(::ActionView) && defined?(::ActionView::PartialRenderer) ScoutApm::Agent.instance.logger.info "Instrumenting ActionView::PartialRenderer" ::ActionView::PartialRenderer.class_eval do include ScoutApm::Tracer instrument_method :render_partial, :type => "View", :name => '#{@template.virtual_path rescue "Unknown Partial"}/Rendering', :scope => true instrument_method :collection_with_template, :type => "View", :name => '#{@template.virtual_path rescue "Unknown Collection"}/Rendering', :scope => true end ScoutApm::Agent.instance.logger.info "Instrumenting ActionView::TemplateRenderer" ::ActionView::TemplateRenderer.class_eval do include ScoutApm::Tracer instrument_method :render_template, :type => "View", :name => '#{args[0].virtual_path rescue "Unknown"}/Rendering', :scope => true end end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems