Class: RuntimeProfiler::ProcessActionEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/runtime_profiler/events/process_action_event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_atObject (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

#payloadObject (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_atObject (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_runtimeObject



17
18
19
# File 'lib/runtime_profiler/events/process_action_event.rb', line 17

def db_runtime
  @db_runtime ||= @payload[:db_runtime]
end

#keyObject



29
30
31
# File 'lib/runtime_profiler/events/process_action_event.rb', line 29

def key
  @key ||= Digest::MD5.hexdigest(path.downcase)
end

#pathObject



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

Returns:

  • (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_runtimeObject



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_runtimeObject



13
14
15
# File 'lib/runtime_profiler/events/process_action_event.rb', line 13

def view_runtime
  @view_runtime ||= @payload[:view_runtime]
end