Sha256: ea20c5bba2262c024320dac9656ed38be86b97e69bc392cd7ec28a6fe073abf0

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
require 'new_relic/agent/transaction_event_aggregator'
require 'new_relic/agent/synthetics_event_aggregator'

module NewRelic
  module Agent
    # This is responsibile for recording transaction events and managing
    # the relationship between events generated from synthetics requests
    # vs normal requests.
    class TransactionEventRecorder
      attr_reader :transaction_event_aggregator
      attr_reader :synthetics_event_aggregator

      def initialize
        @transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new
        @synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new
      end

      def record payload
        return unless NewRelic::Agent.config[:'analytics_events.enabled']

        event = TransactionEvent.new payload

        if event.synthetics?
          _, rejected = synthetics_event_aggregator.append_or_reject event.to_collector_array
          transaction_event_aggregator.record event if rejected
        else
          transaction_event_aggregator.record event.to_collector_array
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/transction_event_recorder.rb
newrelic_rpm-3.15.2.317 lib/new_relic/agent/transction_event_recorder.rb
newrelic_rpm-3.15.1.316 lib/new_relic/agent/transction_event_recorder.rb
newrelic_rpm-3.15.0.314 lib/new_relic/agent/transction_event_recorder.rb
newrelic_rpm-3.14.3.313 lib/new_relic/agent/transction_event_recorder.rb
newrelic_rpm-3.14.2.312 lib/new_relic/agent/transction_event_recorder.rb