Class: RuntimeProfiler::ProcessActionEvent
- Inherits:
-
Object
- Object
- RuntimeProfiler::ProcessActionEvent
- Defined in:
- lib/runtime_profiler/events/process_action_event.rb
Instance Attribute Summary collapse
-
#finished_at ⇒ Object
readonly
Returns the value of attribute finished_at.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
Instance Method Summary collapse
- #db_runtime ⇒ Object
-
#initialize(args:) ⇒ ProcessActionEvent
constructor
A new instance of ProcessActionEvent.
- #key ⇒ Object
- #path ⇒ Object
- #recordable? ⇒ Boolean
- #total_runtime ⇒ Object
- #view_runtime ⇒ Object
Constructor Details
#initialize(args:) ⇒ ProcessActionEvent
Returns a new instance of ProcessActionEvent.
5 6 7 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 5 def initialize(args:) _name, @started_at, @finished_at, _unique_id, @payload = args end |
Instance Attribute Details
#finished_at ⇒ Object (readonly)
Returns the value of attribute finished_at.
3 4 5 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 3 def finished_at @finished_at end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
3 4 5 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 3 def payload @payload end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
3 4 5 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 3 def started_at @started_at end |
Instance Method Details
#db_runtime ⇒ Object
17 18 19 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 17 def db_runtime @db_runtime ||= @payload[:db_runtime] end |
#key ⇒ Object
29 30 31 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 29 def key @key ||= Digest::MD5.hexdigest(path.downcase) end |
#path ⇒ Object
25 26 27 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 25 def path @path ||= @payload[:path].gsub(/(\S=)(?:(?!&).)+/, '\1xxx').gsub(/(\d+)/, 'xxx') end |
#recordable? ⇒ Boolean
21 22 23 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 21 def recordable? true # NB: We may be putting login on this in the future end |
#total_runtime ⇒ Object
9 10 11 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 9 def total_runtime 1000.0 * (@finished_at - @started_at) end |
#view_runtime ⇒ Object
13 14 15 |
# File 'lib/runtime_profiler/events/process_action_event.rb', line 13 def view_runtime @view_runtime ||= @payload[:view_runtime] end |