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)
      return if @closed
      len = @traces.length
      if len < @max_size || @max_size <= 0
        @traces << trace
      else
        replace_index = rand(len)
        replaced_trace = @traces.delete_at(replace_index)
        @traces << trace
        measure_drop(replaced_trace) if replaced_trace
      end
      measure_accept(trace)
    end
def push ( trace ) return if @closed len = @traces . length if len < @max_size || @max_size <= 0 @traces << trace else replace_index = rand ( len ) replaced_trace = @traces . delete_at ( replace_index ) @traces << trace measure_drop ( replaced_trace ) if replaced_trace end measure_accept ( trace ) 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 # Check if we deleted the element right when the buffer # was popped. In that case we didn't actually delete anything, # we just inserted into a newly cleared buffer instead.
trace
<not_specific>