lib/instana/tracing/processor.rb in instana-1.199.6 vs lib/instana/tracing/processor.rb in instana-1.200.0.pre1

- old
+ new

@@ -3,31 +3,34 @@ require 'thread' module Instana class Processor + extend Forwardable + def_delegators :@queue, :empty? + def initialize(logger: ::Instana.logger) # The main queue before being reported to the # host agent. Spans in this queue are complete # and ready to be sent. @queue = Queue.new # This is the maximum number of spans we send to the host # agent at once. @batch_size = 3000 @logger = logger - @pid = $PROCESS_ID + @pid = Process.pid end # Adds a span to the span queue # # @param [Trace] - the trace to be added to the queue def add_span(span) # :nocov: - if @pid != $PROCESS_ID - @logger.info("Proces `#{@pid}` has forked into #{$PROCESS_ID}. Resetting discovery.") - ::Instana.agent.spawn_background_thread - @pid = $PROCESS_ID + if @pid != Process.pid + @logger.info("Proces `#{@pid}` has forked into #{Process.pid}. Running post fork hook.") + ::Instana.config[:post_fork_proc].call + @pid = Process.pid end # :nocov: @queue.push(span) end