lib/instana/tracing/processor.rb in instana-1.10.0.slimfast vs lib/instana/tracing/processor.rb in instana-1.10.0

- old
+ new

@@ -15,23 +15,21 @@ # Adds a Set of spans to the queue # # @param [spans] - the trace to be added to the queue def add_spans(spans) - # Do a quick checkup on our background thread. - if ::Instana.agent.collect_thread.nil? || !::Instana.agent.collect_thread.alive? - ::Instana.agent.spawn_background_thread - end spans.each { |span| @queue.push(span)} end # Adds a span to the span queue # # @param [Trace] - the trace to be added to the queue def add_span(span) - # Do a quick checkup on our background thread. - if ::Instana.agent.collect_thread.nil? || !::Instana.agent.collect_thread.alive? - ::Instana.agent.spawn_background_thread + # Occasionally, do a checkup on our background thread. + if rand(10) > 8 + if ::Instana.agent.collect_thread.nil? || !::Instana.agent.collect_thread.alive? + ::Instana.agent.spawn_background_thread + end end @queue.push(span) end ##