Class: NewRelic::NoticedError
- Inherits:
-
Object
- Object
- NewRelic::NoticedError
- Extended by:
- CollectionHelper
- Defined in:
- lib/new_relic/noticed_error.rb
Overview
This class encapsulates an error that was noticed by New Relic in a managed app.
Constant Summary
Constants included from CollectionHelper
CollectionHelper::DEFAULT_ARRAY_TRUNCATION_SIZE, CollectionHelper::DEFAULT_TRUNCATION_SIZE
Instance Attribute Summary collapse
-
#exception_class ⇒ Object
Returns the value of attribute exception_class.
-
#exception_id ⇒ Object
readonly
Returns the value of attribute exception_id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(path, data, exception, timestamp = Time.now) ⇒ NoticedError
constructor
A new instance of NoticedError.
- #to_collector_array(marshaller = nil) ⇒ Object
Methods included from CollectionHelper
normalize_params, strip_nr_from_backtrace
Constructor Details
#initialize(path, data, exception, timestamp = Time.now) ⇒ NoticedError
Returns a new instance of NoticedError.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/new_relic/noticed_error.rb', line 7 def initialize(path, data, exception, = Time.now) @exception_id = exception.object_id @path = path @params = NewRelic::NoticedError.normalize_params(data) @exception_class = exception.is_a?(Exception) ? exception.class.name : 'Error' if exception.respond_to?('original_exception') @message = exception.original_exception..to_s else @message = (exception || '<no message>').to_s end # clamp long messages to 4k so that we don't send a lot of # overhead across the wire @message = @message[0..4095] if @message.length > 4096 # obfuscate error message if necessary if NewRelic::Agent.config[:high_security] @message = NewRelic::Agent::Database.obfuscate_sql(@message) end @timestamp = end |
Instance Attribute Details
#exception_class ⇒ Object
Returns the value of attribute exception_class.
4 5 6 |
# File 'lib/new_relic/noticed_error.rb', line 4 def exception_class @exception_class end |
#exception_id ⇒ Object (readonly)
Returns the value of attribute exception_id.
5 6 7 |
# File 'lib/new_relic/noticed_error.rb', line 5 def exception_id @exception_id end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/new_relic/noticed_error.rb', line 4 def @message end |
#params ⇒ Object
Returns the value of attribute params.
4 5 6 |
# File 'lib/new_relic/noticed_error.rb', line 4 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/new_relic/noticed_error.rb', line 4 def path @path end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
4 5 6 |
# File 'lib/new_relic/noticed_error.rb', line 4 def @timestamp end |
Instance Method Details
#==(other) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/new_relic/noticed_error.rb', line 32 def ==(other) if other.respond_to?(:exception_id) @exception_id == other.exception_id else false end end |
#to_collector_array(marshaller = nil) ⇒ Object
40 41 42 43 |
# File 'lib/new_relic/noticed_error.rb', line 40 def to_collector_array(marshaller=nil) [ (@timestamp.to_f * 1000).round, @path, @message, @exception_class, @params ] end |