class NewRelic::Agent::Instrumentation::ActionViewSubscriber::RenderEvent
Public Instance Methods
metric_action(name)
click to toggle source
# File lib/new_relic/agent/instrumentation/action_view_subscriber.rb, line 83 def metric_action(name) case name when /render_template.action_view$/ then 'Rendering' when 'render_partial.action_view' then 'Partial' when 'render_collection.action_view' then 'Partial' end end
metric_name()
click to toggle source
# File lib/new_relic/agent/instrumentation/action_view_subscriber.rb, line 56 def metric_name if parent && (payload[:virtual_path] || (parent.payload[:identifier] =~ /template$/)) return parent.metric_name elsif payload.key?(:virtual_path) identifier = payload[:virtual_path] else identifier = payload[:identifier] end # memoize @metric_name ||= "View/#{metric_path(identifier)}/#{metric_action(name)}" @metric_name end
metric_path(identifier)
click to toggle source
# File lib/new_relic/agent/instrumentation/action_view_subscriber.rb, line 71 def metric_path(identifier) if identifier == nil 'file' elsif identifier =~ /template$/ identifier elsif (parts = identifier.split('/')).size > 1 parts[-2..-1].join('/') else ::NewRelic::Agent::UNKNOWN_METRIC end end
recordable?()
click to toggle source
Nearly every “render_blah.action_view” event has a child in the form of “!render_blah.action_view”. The children are the ones we want to record. There are a couple special cases of events without children.
# File lib/new_relic/agent/instrumentation/action_view_subscriber.rb, line 50 def recordable? name[0] == '!' || metric_name == 'View/text template/Rendering' || metric_name == "View/#{::NewRelic::Agent::UNKNOWN_METRIC}/Partial" end