Class: NewRelic::Agent::ErrorEventAggregator

Inherits:
EventAggregator show all
Includes:
Coerce
Defined in:
lib/new_relic/agent/error_event_aggregator.rb

Instance Method Summary collapse

Methods included from Coerce

boolean_int!, float, float!, int, int!, int_or_nil, log_failure, scalar, string, value_or_nil

Methods inherited from EventAggregator

#after_harvest, #after_initialize, buffer_class, capacity_key, #enabled?, enabled_fn, enabled_keys, #harvest!, #has_metadata?, #initialize, #merge!, named, #reset!

Constructor Details

This class inherits a constructor from NewRelic::Agent::EventAggregator

Instance Method Details

#record(noticed_error, transaction_payload = nil, span_id = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/new_relic/agent/error_event_aggregator.rb', line 21

def record(noticed_error, transaction_payload = nil, span_id = nil)
  return unless enabled?

  priority = float!((transaction_payload && transaction_payload[:priority]) || rand)

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