Class: OneApm::Agent::Instrumentation::ActionViewSubscriber::RenderEvent
- Inherits:
-
Event
- Object
- Event
- OneApm::Agent::Instrumentation::ActionViewSubscriber::RenderEvent
- Defined in:
- lib/one_apm/inst/rails4/action_view_subscriber.rb
Instance Attribute Summary
Attributes inherited from Event
#children, #end, #frame, #name, #parent, #payload, #time, #transaction_id
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”.
Methods inherited from Event
#<<, #duration, #initialize, #parent_of?
Constructor Details
This class inherits a constructor from OneApm::Agent::Instrumentation::Event
Instance Method Details
#metric_action(name) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/one_apm/inst/rails4/action_view_subscriber.rb', line 82 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
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/one_apm/inst/rails4/action_view_subscriber.rb', line 55 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) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/one_apm/inst/rails4/action_view_subscriber.rb', line 70 def metric_path(identifier) if identifier == nil 'file' elsif identifier =~ /template$/ identifier elsif (parts = identifier.split('/')).size > 1 parts[-2..-1].join('/') else OneApm::Transaction::OA_UNKNOWN_METRIC 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.
49 50 51 52 53 |
# File 'lib/one_apm/inst/rails4/action_view_subscriber.rb', line 49 def recordable? name[0] == '!' || metric_name == 'View/text template/Rendering' || metric_name == "View/#{OneApm::Transaction::OA_UNKNOWN_METRIC}/Partial" end |