lib/ddtrace/buffer.rb
# Add a new ``trace`` in the local queue. This method doesn't block the execution
# even if the buffer is full. In that case, a random trace is discarded.
Add a new ``trace`` in the local queue. This method doesn't block the execution
even if the buffer is full. In that case, a random trace is discarded.
Add a new ` ` trace ` ` in the local queue . This method doesn ' t block the execution even if the buffer is full . In that case a random trace is discarded .
def push(trace)
      @mutex.synchronize do
        return if @closed
        len = @traces.length
        if len < @max_size || @max_size <= 0
          @traces << trace
        else
          replace_index = rand(len)
          replaced_trace = @traces[replace_index]
          @traces[replace_index] = trace
          measure_drop(replaced_trace)
        end
        measure_accept(trace)
      end
    end
def push ( trace ) @mutex . synchronize do return if @closed len = @traces . length if len < @max_size || @max_size <= 0 @traces << trace else replace_index = rand ( len ) replaced_trace = @traces [ replace_index ] @traces [ replace_index ] = trace measure_drop ( replaced_trace ) end measure_accept ( trace ) end end
Add a new ``trace`` in the local queue.
Add a new ` ` trace ` ` in the local queue .
# we should replace a random trace with the new one
trace
<not_specific>