Class: NewRelic::Agent::Instrumentation::ActionViewSubscriber::RenderEvent
- Inherits:
-
ActiveSupport::Notifications::Event
- Object
- ActiveSupport::Notifications::Event
- NewRelic::Agent::Instrumentation::ActionViewSubscriber::RenderEvent
- Defined in:
- lib/new_relic/agent/instrumentation/rails4/action_view.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
- #metric_action(name) ⇒ Object
- #metric_name ⇒ Object
- #metric_path(identifier) ⇒ Object
-
#recordable? ⇒ Boolean
Nearly every “render_blah.action_view” event has a child in the form of “!render_blah.action_view”.
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
66 67 68 |
# File 'lib/new_relic/agent/instrumentation/rails4/action_view.rb', line 66 def parent @parent end |
#scope ⇒ Object
Returns the value of attribute scope.
66 67 68 |
# File 'lib/new_relic/agent/instrumentation/rails4/action_view.rb', line 66 def scope @scope end |
Instance Method Details
#metric_action(name) ⇒ Object
105 106 107 108 109 110 111 |
# File 'lib/new_relic/agent/instrumentation/rails4/action_view.rb', line 105 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 ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/new_relic/agent/instrumentation/rails4/action_view.rb', line 78 def metric_name if parent && (payload[:virtual_path] || (parent.payload[:identifier] =~ /template$/)) return parent.metric_name elsif payload[: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) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/new_relic/agent/instrumentation/rails4/action_view.rb', line 93 def metric_path(identifier) if identifier == nil 'file' elsif identifier =~ /template$/ identifier elsif (parts = identifier.split('/')).size > 1 parts[-2..-1].join('/') else '(unknown)' end end |
#recordable? ⇒ Boolean
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.
72 73 74 75 76 |
# File 'lib/new_relic/agent/instrumentation/rails4/action_view.rb', line 72 def recordable? name[0] == '!' || metric_name == 'View/text template/Rendering' || metric_name == 'View/(unknown)/Partial' end |