Class: ScoutApm::ErrorService::Payload
- Inherits:
-
Object
- Object
- ScoutApm::ErrorService::Payload
- Defined in:
- lib/scout_apm/error_service/payload.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(context, errors) ⇒ Payload
constructor
A new instance of Payload.
-
#serialize ⇒ Object
TODO: Don’t use to_json since it isn’t supported in Ruby 1.8.7.
- #serialize_error_record(error_record) ⇒ Object
Constructor Details
#initialize(context, errors) ⇒ Payload
Returns a new instance of Payload.
7 8 9 10 |
# File 'lib/scout_apm/error_service/payload.rb', line 7 def initialize(context, errors) @context = context @errors = errors end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/scout_apm/error_service/payload.rb', line 4 def context @context end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/scout_apm/error_service/payload.rb', line 5 def errors @errors end |
Instance Method Details
#as_json ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/scout_apm/error_service/payload.rb', line 19 def as_json serialized_errors = errors.map do |error_record| serialize_error_record(error_record) end { :notifier => "scout_apm_ruby", :environment => context.environment.env, :root => context.environment.root, :problems => serialized_errors, } end |
#serialize ⇒ Object
TODO: Don’t use to_json since it isn’t supported in Ruby 1.8.7
13 14 15 16 17 |
# File 'lib/scout_apm/error_service/payload.rb', line 13 def serialize payload = as_json.to_json context.logger.debug(payload) payload end |
#serialize_error_record(error_record) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/scout_apm/error_service/payload.rb', line 32 def serialize_error_record(error_record) { :exception_class => error_record.exception_class, :message => error_record., :request_uri => error_record.request_uri, :request_params => error_record.request_params, :request_session => error_record.request_session, :environment => error_record.environment, :trace => error_record.trace, :request_components => error_record.request_components, :context => error_record.context, } end |