def add_backtrace_to_span(bt, limit = nil, span)
      frame_count = 0
      span[:stack] = []

      bt.each do |i|
        # If the stack has the full instana gem version in it's path
        # then don't include that frame. Also don't exclude the Rack module.
        if !i.match(/instana\/instrumentation\/rack.rb/).nil? ||
          (i.match(::Instana::VERSION_FULL).nil? && i.match('lib/instana/').nil?)

          break if limit && frame_count >= limit

          x = i.split(':')

          span[:stack] << {
            :f => x[0],
            :n => x[1],
            :m => x[2]
          }
         frame_count = frame_count + 1 if limit
        end
      end
    end
def add_backtrace_to_span(bt, limit = nil, span)
      frame_count = 0
      span[:stack] = []

      bt.each do |i|
        # If the stack has the full instana gem version in it's path
        # then don't include that frame. Also don't exclude the Rack module.
        if !i.match(/instana\/instrumentation\/rack.rb/).nil? ||
          (i.match(::Instana::VERSION_FULL).nil? && i.match('lib/instana/').nil?)

          break if limit && frame_count >= limit

          x = i.split(':')

          span[:stack] << {
            :f => x[0],
            :n => x[1],
            :m => x[2]
          }
         frame_count = frame_count + 1 if limit
        end
      end
    end
Adds the passed in backtrace to the specified span.  Backtrace can be one
 generated from Kernel.caller or one attached to an exception

 @param bt [Array] the backtrace
 @param limit [Integer] Limit the backtrace to the top <limit> frames
 @param span [Span] the span to add the backtrace to or if unspecified
   the current span