Method: Eye::Process::Data#self_status_data

Defined in:
lib/eye/process/data.rb

#self_status_data(debug = false) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/eye/process/data.rb', line 36

def self_status_data(debug = false)
  h = { name: name, state: state,
        type: (self.class == Eye::ChildProcess ? :child_process : :process),
        resources: Eye::SystemResources.resources(pid) }

  if @states_history
    h.merge!( state_changed_at: @states_history.last_state_changed_at.to_i,
              state_reason: @states_history.last_reason )
  end

  h.merge!(debug: debug_data) if debug
  h.merge!(current_command: current_scheduled_command) if current_scheduled_command

  h
end