def log_end(name, kvs = {}, end_time = ::Instana::Util.now_in_ms)
      return unless tracing?

      if ::Instana.debug? || ::Instana.test?
        unless current_span_name?(name)
          ::Instana.logger.debug "Span mismatch: Attempt to end #{name} span but #{current_span.name} is active."
        end
      end

      self.current_trace.finish(kvs, end_time)

      if ::Instana.agent.ready?
        if !self.current_trace.has_async? ||
            (self.current_trace.has_async? && self.current_trace.complete?)
          Instana.processor.add(self.current_trace)
        else
          # This trace still has outstanding/uncompleted asynchronous spans.
          # Put it in the staging queue until the async span closes out or
          # 5 minutes has passed.  Whichever comes first.
          Instana.processor.stage(self.current_trace)
        end
      end
      self.current_trace = nil
    end
def log_end(name, kvs = {}, end_time = ::Instana::Util.now_in_ms)
      return unless tracing?

      if ::Instana.debug? || ::Instana.test?
        unless current_span_name?(name)
          ::Instana.logger.debug "Span mismatch: Attempt to end #{name} span but #{current_span.name} is active."
        end
      end

      self.current_trace.finish(kvs, end_time)

      if ::Instana.agent.ready?
        if !self.current_trace.has_async? ||
            (self.current_trace.has_async? && self.current_trace.complete?)
          Instana.processor.add(self.current_trace)
        else
          # This trace still has outstanding/uncompleted asynchronous spans.
          # Put it in the staging queue until the async span closes out or
          # 5 minutes has passed.  Whichever comes first.
          Instana.processor.stage(self.current_trace)
        end
      end
      self.current_trace = nil
    end
Closes out the current span in the current trace
 and queues the trace for reporting

 @note `name` isn't really required but helps keep sanity that
 we're ending the span that we really want to close out.

 @param name [String] the name of the span to end
 @param kvs [Hash] list of key values to be reported in the span