Method: NewRelic::Agent::PrioritySampledBuffer#append
- Defined in:
- lib/new_relic/agent/priority_sampled_buffer.rb
#append(priority: nil, event: nil, &blk) ⇒ Object Also known as: append_event
expects priority and a block, or an event as a hash with a ‘priority` key.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/new_relic/agent/priority_sampled_buffer.rb', line 28 def append(priority: nil, event: nil, &blk) increment_seen return if @capacity == 0 if full? priority ||= priority_for(event) if priority_for(@items[0]) < priority heapify_items_array incoming = event || yield @items[0] = incoming @items.fix(0) incoming end else @items << (event || yield) @captured_lifetime += 1 @items[-1] end end |