class NewRelic::Agent::TransactionEventAggregator

Public Instance Methods

append(event=nil, &blk) click to toggle source
# File lib/new_relic/agent/transaction_event_aggregator.rb, line 17
def append event=nil, &blk
  raise ArgumentError, "Expected argument or block, but received both" if event && blk
  return unless enabled?

  @lock.synchronize do
    @buffer.append event, &blk
    notify_if_full
  end
end

Private Instance Methods

after_harvest(metadata) click to toggle source
# File lib/new_relic/agent/transaction_event_aggregator.rb, line 29
def after_harvest metadata
  return unless enabled?
  record_sampling_rate metadata
end
record_sampling_rate(metadata) click to toggle source
# File lib/new_relic/agent/transaction_event_aggregator.rb, line 34
def record_sampling_rate(metadata) #THREAD_LOCAL_ACCESS
  NewRelic::Agent.logger.debug("Sampled %d / %d (%.1f %%) requests this cycle, %d / %d (%.1f %%) since startup" % [
    metadata[:captured],
    metadata[:seen],
    (metadata[:captured].to_f / metadata[:seen] * 100.0),
    metadata[:captured_lifetime],
    metadata[:seen_lifetime],
    (metadata[:captured_lifetime].to_f / metadata[:seen_lifetime] * 100.0)
  ])

  engine = NewRelic::Agent.instance.stats_engine
  engine.tl_record_supportability_metric_count("TransactionEventAggregator/requests", metadata[:seen])
  engine.tl_record_supportability_metric_count("TransactionEventAggregator/samples", metadata[:captured])
end