class NewRelic::Agent::TransactionEventRecorder

This is responsibile for recording transaction events and managing the relationship between events generated from synthetics requests vs normal requests.

This is responsibile for recording transaction events and managing the relationship between events generated from synthetics requests vs normal requests.

Attributes

synthetics_event_aggregator[R]
transaction_event_aggregator[R]

Public Class Methods

new() click to toggle source
# File lib/new_relic/agent/transaction_event_recorder.rb, line 16
def initialize
  @transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new
  @synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new
end

Public Instance Methods

create_event(payload) click to toggle source
# File lib/new_relic/agent/transaction_event_recorder.rb, line 33
def create_event payload
  TransactionEventPrimitive.create payload
end
drop_buffered_data() click to toggle source
# File lib/new_relic/agent/transaction_event_recorder.rb, line 41
def drop_buffered_data
  transaction_event_aggregator.reset!
  synthetics_event_aggregator.reset!
end
record(payload) click to toggle source
# File lib/new_relic/agent/transaction_event_recorder.rb, line 21
def record payload
  return unless NewRelic::Agent.config[:'analytics_events.enabled']

  if synthetics_event? payload
    event = create_event payload
    _, rejected = synthetics_event_aggregator.append_or_reject event
    transaction_event_aggregator.append event if rejected
  else
    transaction_event_aggregator.append { create_event(payload) }
  end
end
synthetics_event?(payload) click to toggle source
# File lib/new_relic/agent/transaction_event_recorder.rb, line 37
def synthetics_event? payload
  payload.key? :synthetics_resource_id
end