Class: TingYun::Instrumentation::Rails::RenderEvent
Instance Attribute Summary
#children, #end, #frame, #name, #parent, #payload, #time, #transaction_id
Instance Method Summary
collapse
#<<, #duration, #initialize, #parent_of?
Instance Method Details
#metric_action(name) ⇒ Object
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/ting_yun/instrumentation/support/action_view_subscriber.rb', line 96
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/ting_yun/instrumentation/support/action_view_subscriber.rb', line 69
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
@metric_name ||= "View/#{metric_path(identifier)}/#{metric_action(name)}"
@metric_name
end
|
#metric_path(identifier) ⇒ Object
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/ting_yun/instrumentation/support/action_view_subscriber.rb', line 84
def metric_path(identifier)
if identifier == nil
'file'
elsif identifier =~ /template$/
identifier
elsif (parts = identifier.split('/')).size > 1
parts[-2..-1].join('/')
else
::TingYun::Agent::UNKNOWN_METRIC
end
end
|
#recordable? ⇒ Boolean
63
64
65
66
67
|
# File 'lib/ting_yun/instrumentation/support/action_view_subscriber.rb', line 63
def recordable?
name[0] == '!' ||
metric_name == 'View/text template/Rendering' ||
metric_name == "View/#{::TingYun::Agent::UNKNOWN_METRIC}/Partial"
end
|