Sha256: 2fed64a721cfb9801b0e6ba85a1458bf2543b70e0db081a17e8f0f964ead1358

Contents?: true

Size: 1.13 KB

Versions: 11

Compression:

Stored size: 1.13 KB

Contents

# -*- ruby -*-
# 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/event_aggregator'
require 'new_relic/agent/transaction_error_primitive'
require 'new_relic/agent/priority_sampled_buffer'

module NewRelic
  module Agent
    class ErrorEventAggregator < EventAggregator

      named :ErrorEventAggregator
      capacity_key :'error_collector.max_event_samples_stored'
      enabled_key :'error_collector.capture_events'
      buffer_class PrioritySampledBuffer

      def record noticed_error, transaction_payload = nil
        return unless enabled?

        priority = (transaction_payload && transaction_payload[:priority]) || rand.round(6)

        @lock.synchronize do
          @buffer.append(priority: priority) do
            create_event(noticed_error, transaction_payload)
          end
          notify_if_full
        end
      end

      private

      def create_event noticed_error, transaction_payload
        TransactionErrorPrimitive.create noticed_error, transaction_payload
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
newrelic_rpm-6.5.0.357 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-6.4.0.356 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-6.3.0.355 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-6.2.0.354 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-6.1.0.352 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-6.0.0.351 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-5.7.0.350 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-5.6.0.349 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-5.5.0.348 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-5.4.0.347 lib/new_relic/agent/error_event_aggregator.rb
newrelic_rpm-5.3.0.346 lib/new_relic/agent/error_event_aggregator.rb