Class: Railswatch::Models::RequestRecord
- Inherits:
-
BaseRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- BaseRecord
- Railswatch::Models::RequestRecord
- Defined in:
- lib/railswatch/models/request_record.rb
Instance Attribute Summary collapse
-
#exception_object ⇒ Object
Returns the value of attribute exception_object.
Instance Method Summary collapse
-
#base_record_hash ⇒ Object
rubocop:disable Metrics/MethodLength.
- #controller_action ⇒ Object
- #controller_action_format ⇒ Object
- #custom_record_hash ⇒ Object
- #db_runtime ⇒ Object
- #db_runtime=(value) ⇒ Object
- #duration ⇒ Object
- #duration=(value) ⇒ Object
- #method ⇒ Object
- #method=(value) ⇒ Object
- #payload_hash ⇒ Object
- #record_hash ⇒ Object
- #view_runtime ⇒ Object
- #view_runtime=(value) ⇒ Object
Methods inherited from BaseRecord
#datetime, #datetime=, #datetimei, #datetimei=, #value
Methods inherited from ApplicationRecord
Instance Attribute Details
#exception_object ⇒ Object
Returns the value of attribute exception_object.
12 13 14 |
# File 'lib/railswatch/models/request_record.rb', line 12 def exception_object @exception_object end |
Instance Method Details
#base_record_hash ⇒ Object
rubocop:disable Metrics/MethodLength
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/railswatch/models/request_record.rb', line 74 def base_record_hash # rubocop:disable Metrics/MethodLength { controller: controller, action: action, format: self.format, status: status, method: http_method, path: path, request_id: request_id, datetime: occurred_at, datetimei: occurred_at.to_i, duration: duration_ms, db_runtime: db_runtime_ms, view_runtime: view_runtime_ms, exception: exception, backtrace: backtrace, http_referer: http_referer, request_context: request_context } end |
#controller_action ⇒ Object
49 50 51 |
# File 'lib/railswatch/models/request_record.rb', line 49 def controller_action "#{controller}##{action}" end |
#controller_action_format ⇒ Object
53 54 55 |
# File 'lib/railswatch/models/request_record.rb', line 53 def controller_action_format "#{controller}##{action}|#{format}" end |
#custom_record_hash ⇒ Object
95 96 97 |
# File 'lib/railswatch/models/request_record.rb', line 95 def custom_record_hash custom_data.is_a?(Hash) ? custom_data.deep_symbolize_keys : {} end |
#db_runtime ⇒ Object
33 34 35 |
# File 'lib/railswatch/models/request_record.rb', line 33 def db_runtime db_runtime_ms end |
#db_runtime=(value) ⇒ Object
37 38 39 |
# File 'lib/railswatch/models/request_record.rb', line 37 def db_runtime=(value) self.db_runtime_ms = value end |
#duration ⇒ Object
41 42 43 |
# File 'lib/railswatch/models/request_record.rb', line 41 def duration duration_ms end |
#duration=(value) ⇒ Object
45 46 47 |
# File 'lib/railswatch/models/request_record.rb', line 45 def duration=(value) self.duration_ms = value end |
#method ⇒ Object
17 18 19 |
# File 'lib/railswatch/models/request_record.rb', line 17 def method http_method end |
#method=(value) ⇒ Object
21 22 23 |
# File 'lib/railswatch/models/request_record.rb', line 21 def method=(value) self.http_method = value end |
#payload_hash ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/railswatch/models/request_record.rb', line 57 def payload_hash { 'view_runtime' => view_runtime_ms, 'db_runtime' => db_runtime_ms, 'duration' => duration_ms, 'http_referer' => http_referer, 'custom_data' => custom_data, 'exception' => exception, 'backtrace' => backtrace, 'request_context' => request_context } end |
#record_hash ⇒ Object
70 71 72 |
# File 'lib/railswatch/models/request_record.rb', line 70 def record_hash base_record_hash.merge(custom_record_hash) end |
#view_runtime ⇒ Object
25 26 27 |
# File 'lib/railswatch/models/request_record.rb', line 25 def view_runtime view_runtime_ms end |
#view_runtime=(value) ⇒ Object
29 30 31 |
# File 'lib/railswatch/models/request_record.rb', line 29 def view_runtime=(value) self.view_runtime_ms = value end |