def send
      return if @queue.empty? || ENV['INSTANA_GEM_TEST']

      size = @queue.size
      if size > 200
        Instana.logger.debug "Trace queue is #{size}"
      end

      # Scan for any staged but incomplete traces that have now
      # completed.
      process_staged

      # Retrieve all spans for queued traces
      spans = queued_spans

      # Report spans in batches
      batch = spans.shift(@batch_size)
      while !batch.empty? do
        ::Instana.agent.report_spans(batch)
        batch = spans.shift(@batch_size)
      end
    end
def send
      return if @queue.empty? || ENV['INSTANA_GEM_TEST']

      size = @queue.size
      if size > 200
        Instana.logger.debug "Trace queue is #{size}"
      end

      # Scan for any staged but incomplete traces that have now
      # completed.
      process_staged

      # Retrieve all spans for queued traces
      spans = queued_spans

      # Report spans in batches
      batch = spans.shift(@batch_size)
      while !batch.empty? do
        ::Instana.agent.report_spans(batch)
        batch = spans.shift(@batch_size)
      end
    end
send

 Sends all traces in @queue to the host
 agent

 FIXME: Add limits checking here in regards to:
   - Max HTTP Post size
   - Out of control/growing queue
   - Prevent another run of the timer while this is running