class NewRelic::Agent::Threading::BacktraceNode
Attributes
Public Class Methods
Source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 84 def initialize(line) super() @raw_line = line @children = [] @runnable_count = 0 end
Calls superclass method
NewRelic::Agent::Threading::BacktraceBase::new
Public Instance Methods
Source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 91 def ==(other) ( @raw_line == other.raw_line && @depth == other.depth && @runnable_count == other.runnable_count ) end
Source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 105 def complete_array_conversion child_arrays = @children.map { |c| c.as_array }.compact file, method, line = parse_backtrace_frame(@raw_line) @as_array << [string(file), string(method), line ? int(line) : UNKNOWN_LINE_NUMBER] @as_array << int(@runnable_count) @as_array << 0 @as_array << child_arrays end
Source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 116 def dump_string(indent = 0) @file, @method, @line_no = parse_backtrace_frame(@raw_line) indentation = ' ' * indent result = +"#{indentation}#<BacktraceNode:#{object_id} ) + \ [#{@runnable_count}] #{@file}:#{@line_no} in #{@method}>" child_results = @children.map { |c| c.dump_string(indent + 2) }.join("\n") result << "\n" unless child_results.empty? result << child_results end
Source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 99 def mark_for_array_conversion @as_array = [] end
Source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 127 def parse_backtrace_frame(frame) # TODO: OLD RUBIES - Ruby 3.3 # The (?:`|') non-capturing group can be removed when the agent # drops support for Ruby 3.3 # This group is used to capture the pre-Ruby 3.4.0 backtrace syntax. # Example frame: # Ruby 3.3.0 and below # "irb.rb:69:in `catch'" # Ruby 3.4.0+ # "irb.rb:69:in 'Kernel#catch'" frame =~ /([^:]*)(\:(\d+))?\:in (?:`|')(.*)'/ [$1, $4, $3] # sic end
Returns [filename, method, line number]