Sha256: 8818f94de3141a8c30806b180ec9db5a3c5a329571a9463ae8ef4cb540084aa0

Contents?: true

Size: 1.03 KB

Versions: 31

Compression:

Stored size: 1.03 KB

Contents

# This class encapsulates an error that was noticed by New Relic in a managed app.
class NewRelic::NoticedError
  extend NewRelic::CollectionHelper
  attr_accessor :path, :timestamp, :params, :exception_class, :message

  def initialize(path, data, exception, timestamp = Time.now)
    self.path = path
    self.params = NewRelic::NoticedError.normalize_params(data)

    self.exception_class = exception.is_a?(Exception) ? exception.class.name : 'Error'

    if exception.respond_to?('original_exception')
      self.message = exception.original_exception.message.to_s
    else
      self.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
    self.message = self.message[0..4095] if self.message.length > 4096
    
    # obfuscate error message if necessary
    if NewRelic::Control.instance.fetch('high_security', false)
      self.message = NewRelic::Agent::Database.obfuscate_sql(self.message)
    end
    
    self.timestamp = timestamp
  end
end

Version data entries

31 entries across 31 versions & 4 rubygems

Version Path
newrelic_rpm-3.4.1 lib/new_relic/noticed_error.rb
newrelic_rpm-3.4.1.beta1 lib/new_relic/noticed_error.rb
ghazel-newrelic_rpm-3.4.0.2 lib/new_relic/noticed_error.rb
newrelic_rpm-3.4.0.1 lib/new_relic/noticed_error.rb
newrelic_rpm-3.4.0 lib/new_relic/noticed_error.rb
newrelic_rpm-3.4.0.beta2 lib/new_relic/noticed_error.rb
newrelic_rpm-3.3.5 lib/new_relic/noticed_error.rb
newrelic_rpm-3.3.5.beta1 lib/new_relic/noticed_error.rb
newrelic_rpm-3.4.0.beta1 lib/new_relic/noticed_error.rb
dolores_rpm-3.3.4.8 lib/new_relic/noticed_error.rb
dolores_rpm-3.3.4.7 lib/new_relic/noticed_error.rb
dolores_rpm-3.3.4.6 lib/new_relic/noticed_error.rb
dolores_rpm-3.3.4.5 lib/new_relic/noticed_error.rb
dolores_rpm-3.3.4.4 lib/new_relic/noticed_error.rb
dolores_rpm-3.3.4.3 lib/new_relic/noticed_error.rb
dolores_rpm-3.3.4.1.fork2 lib/new_relic/noticed_error.rb
dolores_rpm-3.3.4.1.fork lib/new_relic/noticed_error.rb
wd_newrelic_rpm-3.3.4.1 lib/new_relic/noticed_error.rb
dolores_rpm-3.3.4.fork lib/new_relic/noticed_error.rb
newrelic_rpm-3.3.4.1 lib/new_relic/noticed_error.rb