class AWS::Flow::Core::AsyncBacktrace
@api private
Public Class Methods
caller(skip)
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 108 def caller(skip) random_var = Kernel.caller 0 this_stuff = 1.upto(6).map { |x| Kernel.caller(x) } other_var = Kernel.caller skip Kernel.caller(@disable_filtering ? 0 : skip) end
create(parent, frames_to_skip)
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 43 def create(parent, frames_to_skip) unless @disable_async_backtrace b = AsyncBacktrace.caller(frames_to_skip) AsyncBacktrace.new(parent, b) end end
create_from_exception(parent, exception)
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 52 def create_from_exception(parent, exception) unless @disable_async_backtrace AsyncBacktrace.new(parent, exception.backtrace); end end
disable()
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 98 def disable @disable_async_backtrace = true end
disable_filtering()
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 88 def disable_filtering @disable_filtering = true end
enable()
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 103 def enable @disable_async_backtrace = false end
enable_filtering()
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 93 def enable_filtering @disable_filtering = false end
filter(backtrace)
click to toggle source
Removes all framework-related frames after application frames. Keep framework frames before application frames.
@todo
The correct implementation should not have framework frames before application frames as it is expected to call Kernel.caller with the correct number. In cases when this number is not correct, the frames are kept to not create confusion.
@api private
# File lib/aws/flow/async_backtrace.rb, line 67 def filter(backtrace) if @disable_filtering backtrace else do_filter(backtrace) end end
merge(*backtraces)
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 76 def merge(*backtraces) result = [] backtraces.each do | b | if b result << "------ continuation ------" if result.size > 0 result += b end end result end
new(parent, backtrace)
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 25 def initialize(parent, backtrace) @backtrace = AsyncBacktrace.filter(backtrace) @parent = parent end
Private Class Methods
do_filter(backtrace)
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 118 def do_filter(backtrace) return nil unless backtrace # Keep asynchrony frames at the top of the backtrace only # then cut all frames starting from asynchrony frame. skip_asynchrony_frames = false @backtrace = backtrace.take_while do |frame| if ! $RUBY_FLOW_FILES.select {|file| Regexp.new(file) =~ frame}.empty? !skip_asynchrony_frames else skip_asynchrony_frames = true end end end
Public Instance Methods
backtrace()
click to toggle source
@api private
# File lib/aws/flow/async_backtrace.rb, line 31 def backtrace if @parent AsyncBacktrace.merge(@backtrace, @parent.backtrace) else @backtrace end end