Class: OneApm::Agent::Threading::BacktraceRoot
Instance Attribute Summary collapse
#children
Instance Method Summary
collapse
#add_child, #add_child_unless_present, #find_child
Constructor Details
Returns a new instance of BacktraceRoot.
36
37
38
39
|
# File 'lib/one_apm/support/backtrace/backtrace_node.rb', line 36
def initialize
super
@flattened = []
end
|
Instance Attribute Details
#flattened ⇒ Object
Returns the value of attribute flattened.
34
35
36
|
# File 'lib/one_apm/support/backtrace/backtrace_node.rb', line 34
def flattened
@flattened
end
|
Instance Method Details
#==(other) ⇒ Object
41
42
43
|
# File 'lib/one_apm/support/backtrace/backtrace_node.rb', line 41
def ==(other)
true
end
|
#aggregate(backtrace) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/one_apm/support/backtrace/backtrace_node.rb', line 49
def aggregate(backtrace)
current = self
depth = 0
backtrace.reverse_each do |frame|
break if depth >= OA_MAX_THREAD_PROFILE_DEPTH
existing_node = current.find_child(frame)
if existing_node
node = existing_node
else
node = Threading::BacktraceNode.new(frame)
current.add_child(node)
@flattened << node
end
node.runnable_count += 1
current = node
depth += 1
end
end
|
#as_array ⇒ Object
45
46
47
|
# File 'lib/one_apm/support/backtrace/backtrace_node.rb', line 45
def as_array
@children.map { |c| c.as_array }.compact
end
|
#dump_string ⇒ Object
71
72
73
74
75
76
|
# File 'lib/one_apm/support/backtrace/backtrace_node.rb', line 71
def dump_string
result = "#<BacktraceRoot:#{object_id}>"
child_results = @children.map { |c| c.dump_string(2) }.join("\n")
result << "\n" unless child_results.empty?
result << child_results
end
|