Method: Instana::Processor#queued_spans

Defined in:
lib/instana/trace/processor.rb

#queued_spansArray

Retrieves all of the traces in @queue and returns the sum of their raw spans. This is used by Processor::send and in the test suite. Note that traces retrieved with this method are removed entirely from the queue.

Returns:

  • (Array)

    An array of [Span] or empty



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/instana/trace/processor.rb', line 89

def queued_spans
  return [] if @queue.empty?

  spans = []
  until @queue.empty?
    # Non-blocking pop; ignore exception
    span = begin
      @queue.pop(true)
    rescue
      nil
    end
    spans << span.raw if span.is_a?(Span) && span.context.level == 1
  end

  spans
end