Method: OneApm::Agent::SampledBuffer#append_event
- Defined in:
- lib/one_apm/support/event_buffer/sampled_buffer.rb
#append_event(x) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/one_apm/support/event_buffer/sampled_buffer.rb', line 27 def append_event(x) if @items.size < @capacity @items << x return x else m = rand(@seen) # [0, @seen) if m < @capacity @items[m] = x return x else # discard current sample return nil end end end |