Class NewRelic::Agent::ErrorCollector
In: lib/new_relic/agent/error_collector.rb
Parent: Object

This class collects errors from the parent application, storing them until they are harvested and transmitted to the server

Methods

Included Modules

NewRelic::CollectionHelper

Constants

MAX_ERROR_QUEUE_LENGTH = 20 unless defined? MAX_ERROR_QUEUE_LENGTH   Maximum possible length of the queue - defaults to 20, may be made configurable in the future. This is a tradeoff between memory and data retention
EXCEPTION_TAG_IVAR = :'@__nr_seen_exception' unless defined? EXCEPTION_TAG_IVAR
EMPTY_STRING = ''.freeze
DEPRECATED_OPTIONS_MSG = "Passing %s to notice_error is no longer supported. Set values on the enclosing transaction or record them as custom attributes instead.".freeze
DEPRECATED_OPTIONS = [:request_params, :request, :referer].freeze

Attributes

error_event_aggregator  [R] 
error_trace_aggregator  [R] 

Public Class methods

We store the passed block in both an ivar on the class, and implicitly within the body of the ignore_filter_proc method intentionally here. The define_method trick is needed to get around the fact that users may call ‘return’ from within their filter blocks, which would otherwise result in a LocalJumpError.

The raw block is also stored in an instance variable so that we can return it later in its original form.

This is all done at the class level in order to avoid the case where the user sets up an ignore filter on one instance of the ErrorCollector, and then that instance subsequently gets discarded during agent startup. (For example, if the agent is initially disabled, and then gets enabled via a call to manual_start later on.)

Returns a new error collector

Public Instance methods

an error is ignored if it is nil or if it is filtered

Calling instance_variable_set on a wrapped Java object in JRuby will generate a warning unless that object‘s class has already been marked as persistent, so we skip tagging of exception objects that are actually wrapped Java objects on JRuby.

See github.com/jruby/jruby/wiki/Persistence

extracts a stack trace from the exception for debugging purposes

Checks the provided error against the error filter, if there is an error filter

Checks the array of error names and the error filter against the provided error

Old options no longer used by notice_error can still be passed. If they are, they shouldn‘t get merged into custom attributes. Delete and warn callers so they can fix their calls to notice_error.

errors is an array of Exception Class Names

Increments a statistic that tracks total error rate

*Use sparingly for difficult to track bugs.*

Track internal agent errors for communication back to New Relic. To use, make a specific subclass of NewRelic::Agent::InternalAgentError, then pass an instance of it to this method when your problem occurs.

Limits are treated differently for these errors. We only gather one per class per harvest, disregarding (and not impacting) the app error queue limit.

calls a method on an object, if it responds to it - used for detection and soft fail-safe. Returns nil if the method does not exist

[Validate]