lib/instana/tracing/processor.rb in instana-1.7.4 vs lib/instana/tracing/processor.rb in instana-1.7.5

- old
+ new

@@ -16,10 +16,14 @@ @staging_queue = Set.new # No access to the @staging_queue until this lock # is taken. @staging_lock = Mutex.new + + # This is the maximum number of spans we send to the host + # agent at once. + @batch_size = 3000 end # Adds a trace to the queue to be processed and # sent to the host agent # @@ -89,10 +93,15 @@ process_staged # Retrieve all spans for queued traces spans = queued_spans - ::Instana.agent.report_spans(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 # 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.