Method: NewRelic::Agent::EventAggregator#merge!
- Defined in:
- lib/new_relic/agent/event_aggregator.rb
permalink #merge!(payload, adjust_count = true) ⇒ Object
Merges samples from payload back into buffer and optionally adjusts the count of the buffer to ensure accuracy of buffer of metadata. We want to make sure not to double count samples being merged back in from a failed harvest, yet we do not want to under-count samples being merged from the PipeService.
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/new_relic/agent/event_aggregator.rb', line 93 def merge!(payload, adjust_count = true) @lock.synchronize do _, samples = payload if adjust_count @buffer.decrement_lifetime_counts_by(samples.count) end samples.each { |s| @buffer.append(event: s) } end end |