class NewRelic::Agent::SpanEventAggregator

Constants

SUPPORTABILITY_DISCARDED
SUPPORTABILITY_TOTAL_SEEN
SUPPORTABILITY_TOTAL_SENT

Public Instance Methods

after_harvest(metadata) click to toggle source
# File lib/new_relic/agent/span_event_aggregator.rb, line 36
def after_harvest(metadata)
  seen = metadata[:seen]
  sent = metadata[:captured]
  discarded = seen - sent

  ::NewRelic::Agent.record_metric(SUPPORTABILITY_TOTAL_SEEN, count: seen)
  ::NewRelic::Agent.record_metric(SUPPORTABILITY_TOTAL_SENT, count: sent)
  ::NewRelic::Agent.record_metric(SUPPORTABILITY_DISCARDED, count: discarded)

  super
end
record(priority: nil, event: nil, &blk) click to toggle source
# File lib/new_relic/agent/span_event_aggregator.rb, line 19
def record(priority: nil, event: nil, &blk)
  unless event || priority && blk
    raise ArgumentError, 'Expected priority and block, or event'
  end

  return unless enabled?

  @lock.synchronize do
    @buffer.append(priority: priority, event: event, &blk)
    notify_if_full
  end
end