Class: Chronicle::ErrorLog
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Chronicle::ErrorLog
- Defined in:
- app/models/chronicle/error_log.rb
Constant Summary collapse
- OPEN =
Constants are re-exported so callers can reference ErrorLog::OPEN etc. without knowing about the group model.
ErrorGroup::OPEN
- RESOLVED =
ErrorGroup::RESOLVED
- IGNORED =
ErrorGroup::IGNORED
- VALID_STATUSES =
ErrorGroup::VALID_STATUSES
Instance Attribute Summary collapse
- #cleaned_backtrace ⇒ Object
- #error_fingerprint ⇒ Object
- #error_message ⇒ Object
- #original_backtrace ⇒ Object
-
#project ⇒ Object
Reader methods: prefer the persisted group value once the log is saved; fall back to the in-memory virtual attribute during the create flow.
- #source_name ⇒ Object
- #source_type ⇒ Object
Instance Method Summary collapse
- #as_json(_options = {}) ⇒ Object
-
#get_hash ⇒ Object
Returns a flat hash that combines the log’s own columns with the key group-level fields inlined for API convenience, plus the full nested group for clients that need it.
Instance Attribute Details
#cleaned_backtrace ⇒ Object
35 |
# File 'app/models/chronicle/error_log.rb', line 35 def cleaned_backtrace = error_group&.cleaned_backtrace || @cleaned_backtrace |
#error_fingerprint ⇒ Object
33 |
# File 'app/models/chronicle/error_log.rb', line 33 def error_fingerprint = error_group&.fingerprint || @error_fingerprint |
#error_message ⇒ Object
32 |
# File 'app/models/chronicle/error_log.rb', line 32 def = error_group&. || @error_message |
#original_backtrace ⇒ Object
34 |
# File 'app/models/chronicle/error_log.rb', line 34 def original_backtrace = error_group&.original_backtrace || @original_backtrace |
#project ⇒ Object
Reader methods: prefer the persisted group value once the log is saved; fall back to the in-memory virtual attribute during the create flow.
29 |
# File 'app/models/chronicle/error_log.rb', line 29 def project = error_group&.project || @project |
#source_name ⇒ Object
31 |
# File 'app/models/chronicle/error_log.rb', line 31 def source_name = error_group&.source_name || @source_name |
#source_type ⇒ Object
30 |
# File 'app/models/chronicle/error_log.rb', line 30 def source_type = error_group&.source_type || @source_type |
Instance Method Details
#as_json(_options = {}) ⇒ Object
57 58 59 |
# File 'app/models/chronicle/error_log.rb', line 57 def as_json( = {}) get_hash end |
#get_hash ⇒ Object
Returns a flat hash that combines the log’s own columns with the key group-level fields inlined for API convenience, plus the full nested group for clients that need it.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/models/chronicle/error_log.rb', line 40 def get_hash group = error_group attributes.symbolize_keys.merge( error_fingerprint: group&.fingerprint, project: group&.project, source_type: group&.source_type, source_name: group&.source_name, error_message: group&., original_backtrace: group&.original_backtrace, cleaned_backtrace: group&.cleaned_backtrace, status: group&.status, jira_link: group&.jira_link, error_group: group&.get_hash, user: (Chronicle.config.user_model&.find_by(id: user_id)&.try(:basic_info) if user_id.present?) ) end |