Class: ErrorLens::ErrorOccurrence
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ErrorLens::ErrorOccurrence
- Defined in:
- app/models/error_lens/error_occurrence.rb
Class Method Summary collapse
Instance Method Summary collapse
- #app_backtrace ⇒ Object
- #parsed_backtrace ⇒ Object
- #parsed_job_args ⇒ Object
- #parsed_parameters ⇒ Object
- #parsed_request_headers ⇒ Object
- #sidekiq? ⇒ Boolean
- #web? ⇒ Boolean
Class Method Details
.purge_older_than(days = 60) ⇒ Object
11 12 13 |
# File 'app/models/error_lens/error_occurrence.rb', line 11 def self.purge_older_than(days = 60) where("occurred_at < ?", days.days.ago).delete_all end |
Instance Method Details
#app_backtrace ⇒ Object
39 40 41 |
# File 'app/models/error_lens/error_occurrence.rb', line 39 def app_backtrace parsed_backtrace.select { |line| line.start_with?(Rails.root.to_s) } end |
#parsed_backtrace ⇒ Object
15 16 17 18 19 |
# File 'app/models/error_lens/error_occurrence.rb', line 15 def parsed_backtrace JSON.parse(backtrace || "[]") rescue JSON::ParserError [] end |
#parsed_job_args ⇒ Object
27 28 29 30 31 |
# File 'app/models/error_lens/error_occurrence.rb', line 27 def parsed_job_args JSON.parse(job_args || "[]") rescue JSON::ParserError [] end |
#parsed_parameters ⇒ Object
21 22 23 24 25 |
# File 'app/models/error_lens/error_occurrence.rb', line 21 def parsed_parameters JSON.parse(parameters || "{}") rescue JSON::ParserError {} end |
#parsed_request_headers ⇒ Object
33 34 35 36 37 |
# File 'app/models/error_lens/error_occurrence.rb', line 33 def parsed_request_headers JSON.parse(request_headers || "{}") rescue JSON::ParserError {} end |
#sidekiq? ⇒ Boolean
47 48 49 |
# File 'app/models/error_lens/error_occurrence.rb', line 47 def sidekiq? source == "sidekiq" end |
#web? ⇒ Boolean
43 44 45 |
# File 'app/models/error_lens/error_occurrence.rb', line 43 def web? source == "web" end |