Module: Eye::Controller::Status

Included in:
Eye::Controller
Defined in:
lib/eye/controller/status.rb

Instance Method Summary collapse

Instance Method Details

#debug_data(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/eye/controller/status.rb', line 3

def debug_data(*args)
  h = args.extract_options!
  actors = Celluloid::Actor.all.map{|actor| actor.__klass__ }.group_by{|a| a}.map{|k,v| [k, v.size]}.sort_by{|a|a[1]}.reverse

  res = {
    :about => Eye::ABOUT,
    :resources => Eye::SystemResources.resources($$),
    :ruby => RUBY_DESCRIPTION,
    :gems => %w|Celluloid Celluloid::IO StateMachine NIO Timers Sigar|.map{|c| gem_version(c) },
    :logger => Eye::Logger.args.present? ? [Eye::Logger.dev.to_s, *Eye::Logger.args] : Eye::Logger.dev.to_s,
    :pid_path => Eye::Local::pid_path,
    :sock_path => Eye::Local::socket_path,
    :actors => actors
  }

  res[:config_yaml] = YAML.dump(current_config.to_h) if h[:config].present?

  res
end

#history_data(*args) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/eye/controller/status.rb', line 31

def history_data(*args)
  res = {}
  history_objects(*args).each do |process|
    res[process.full_name] = process.schedule_history.reject{|c| c[:state] == :check_crash }
  end
  res
end

#info_data(*args) ⇒ Object



23
24
25
# File 'lib/eye/controller/status.rb', line 23

def info_data(*args)
  {:subtree => info_objects(*args).map{|a| a.status_data } }
end

#short_data(*args) ⇒ Object



27
28
29
# File 'lib/eye/controller/status.rb', line 27

def short_data(*args)
  {:subtree => info_objects(*args).select{ |o| o.class == Eye::Application }.map{|a| a.status_data_short } }
end