class NewRelic::Agent::TransactionEventRecorder
This is responsible 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(events)
click to toggle source
# File lib/new_relic/agent/transaction_event_recorder.rb, line 18 def initialize(events) @transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new(events) @synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new(events) end
Public Instance Methods
create_event(payload)
click to toggle source
# File lib/new_relic/agent/transaction_event_recorder.rb, line 35 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 43 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 23 def record(payload) return unless NewRelic::Agent.config[:'transaction_events.enabled'] if synthetics_event?(payload) event = create_event(payload) result = synthetics_event_aggregator.record(event) transaction_event_aggregator.record(event: event) if result.nil? else transaction_event_aggregator.record(priority: payload[:priority]) { create_event(payload) } end end
synthetics_event?(payload)
click to toggle source
# File lib/new_relic/agent/transaction_event_recorder.rb, line 39 def synthetics_event?(payload) payload.key?(:synthetics_resource_id) end