Class: EndPointBlank::Writers::ExceptionWriter
- Inherits:
-
Object
- Object
- EndPointBlank::Writers::ExceptionWriter
- Includes:
- DelayedWriter, Shared, Singleton
- Defined in:
- lib/end_point_blank/writers/exception_writer.rb
Constant Summary
Constants included from DelayedWriter
DelayedWriter::MAX_QUEUE_SIZE, DelayedWriter::WARN_THROTTLE_SECONDS
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ExceptionWriter
constructor
A new instance of ExceptionWriter.
- #payload(exception) ⇒ Object
- #write(exception) ⇒ Object
Methods included from Shared
#app_name, #apply_masking, #configuration, #env, #env_name, #request_uuid, #source_application_environment_id
Methods included from DelayedWriter
#direct_writer, #enqueue, #log_warning, #pop_additional, #queue, #start_threads
Constructor Details
#initialize ⇒ ExceptionWriter
Returns a new instance of ExceptionWriter.
14 15 16 17 |
# File 'lib/end_point_blank/writers/exception_writer.rb', line 14 def initialize @url = EndPointBlank::Configuration.instance.errors_url start_threads end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
12 13 14 |
# File 'lib/end_point_blank/writers/exception_writer.rb', line 12 def url @url end |
Class Method Details
.write(exception) ⇒ Object
19 20 21 |
# File 'lib/end_point_blank/writers/exception_writer.rb', line 19 def self.write(exception) instance.write(exception) end |
Instance Method Details
#payload(exception) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/end_point_blank/writers/exception_writer.rb', line 23 def payload(exception) env = ::EndPointBlank::Rack::EnvStore.get request = ::Rack::Request.new(env) version = Commands::VersionFinder.new.find(request) { app_name: app_name, uuid: request_uuid(env), message: exception., stacktrace: exception.backtrace, sent_at: Time.now.utc.iso8601(3), source_application_environment_id: source_application_environment_id } end |
#write(exception) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/end_point_blank/writers/exception_writer.rb', line 37 def write(exception) p = payload(exception) rack_req = ::EndPointBlank::Rack::EnvStore.request if rack_req p = p.merge( stamped_path: rack_req.path, stamped_http_method: rack_req.request_method ) end enqueue(apply_masking(p, :error)) end |