puma-status 1.4 → 1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22bea1d3a501185590a81878994456d75a4c5375794221bdeb51b3283d65cceb
4
- data.tar.gz: a2670a54fdd6c4dae1040c59882f969ba1aff3487076d75962e2fa105da32b59
3
+ metadata.gz: edca43a85e295ab116159f64a2f938f08ca8bb228d3c9a1858e3e6b1c2af42d5
4
+ data.tar.gz: ed4e67eef12e37bc463573ab8e1b2e2f7d7b04654e23615ff68461822e2af74e
5
5
  SHA512:
6
- metadata.gz: '09d1cfd981ee0c5092e9bda66009e2a4b517f3bfe3987559cfb571a9a4aa0c880e6ca45061cbd0a0c8bbc5016d2a11ba3410facc67b9924ab7643512110b2711'
7
- data.tar.gz: 023b10377d8567d59c3b75028c4cd54c2f3db12d686bcf41d5a6fcd69aabf45c6e5a89b3c956afa8e98d7ec696c5ef85801fd6a8625adf6b9d42a1aea9a584fc
6
+ metadata.gz: 0ac75cb6ba28f5e69856fc93144cd0cd06543281da12654ea15d95e1281b571e6c4caf9d81f466cdd48b21819f4e47f6d205ccffc95130c1a17a55d58ae46f15
7
+ data.tar.gz: 1ab7b9ee34dd4674bea3398f6d4c69431e4c64cac105d4651bf0f0dcad113223727be6984373b1ee7f8a678c4b91db36ba3f7d117696aac57e39b433582d4cf6
data/lib/core.rb CHANGED
@@ -76,11 +76,13 @@ def hydrate_stats(stats, puma_state, state_file_path)
76
76
  end
77
77
 
78
78
  def format_stats(stats)
79
- master_line = "#{stats.pid} (#{stats.state_file_path}) Uptime: #{seconds_to_human(stats.uptime)}"
79
+ master_line = "#{stats.pid} (#{stats.state_file_path})"
80
+ master_line += " Version: #{stats.version} |" if stats.version
81
+ master_line += " Uptime: #{seconds_to_human(stats.uptime)}"
80
82
  master_line += " | Phase: #{stats.phase}" if stats.phase
81
83
 
82
84
  if stats.booting?
83
- master_line += " #{warn("booting")}"
85
+ master_line += " #{yellow("booting")}"
84
86
  else
85
87
  master_line += " | Load: #{color(75, 50, stats.load, asciiThreadLoad(stats.running_threads, stats.spawned_threads, stats.max_threads))}"
86
88
  master_line += " | Req: #{stats.requests_count}" if stats.requests_count
@@ -90,15 +92,15 @@ def format_stats(stats)
90
92
  worker_line = " └ #{wstats.pid.to_s.rjust(5, ' ')} CPU: #{color(75, 50, wstats.pcpu, wstats.pcpu.to_s.rjust(5, ' '))}% Mem: #{color(1000, 750, wstats.mem, wstats.mem.to_s.rjust(4, ' '))} MB Uptime: #{seconds_to_human(wstats.uptime)}"
91
93
 
92
94
  if wstats.booting?
93
- worker_line += " #{warn("booting")}"
95
+ worker_line += " #{yellow("booting")}"
94
96
  elsif wstats.killed?
95
- worker_line += " #{error("killed")}"
97
+ worker_line += " #{red("killed")}"
96
98
  else
97
99
  worker_line += " | Load: #{color(75, 50, wstats.load, asciiThreadLoad(wstats.running_threads, wstats.spawned_threads, wstats.max_threads))}"
98
- worker_line += " | Phase: #{error(wstats.phase)}" if wstats.phase != stats.phase
100
+ worker_line += " | Phase: #{red(wstats.phase)}" if wstats.phase != stats.phase
99
101
  worker_line += " | Req: #{wstats.requests_count}" if wstats.requests_count
100
- worker_line += " Queue: #{error(wstats.backlog.to_s)}" if wstats.backlog > 0
101
- worker_line += " Last checkin: #{error(wstats.last_checkin)}" if wstats.last_checkin >= 10
102
+ worker_line += " Queue: #{red(wstats.backlog.to_s)}" if wstats.backlog > 0
103
+ worker_line += " Last checkin: #{red(wstats.last_checkin)}" if wstats.last_checkin >= 10
102
104
  end
103
105
 
104
106
  worker_line
data/lib/helpers.rb CHANGED
@@ -4,11 +4,11 @@ def debug(str)
4
4
  puts str if ENV.key?('DEBUG')
5
5
  end
6
6
 
7
- def warn(str)
7
+ def yellow(str)
8
8
  colorize(str, :yellow)
9
9
  end
10
10
 
11
- def error(str)
11
+ def red(str)
12
12
  colorize(str, :red)
13
13
  end
14
14
 
data/lib/puma-status.rb CHANGED
@@ -19,22 +19,22 @@ def run
19
19
  format_stats(get_stats(state_file_path))
20
20
  rescue Errno::ENOENT => e
21
21
  if e.message =~ /#{state_file_path}/
22
- errors << "#{warn(state_file_path)} doesn't exists"
22
+ errors << "#{yellow(state_file_path)} doesn't exists"
23
23
  elsif e.message =~ /connect\(2\) for [^\/]/
24
- errors << "#{warn("Relative Unix socket")}: the Unix socket of the control app has a relative path. Please, ensure you are running from the same folder has puma."
24
+ errors << "#{yellow("Relative Unix socket")}: the Unix socket of the control app has a relative path. Please, ensure you are running from the same folder has puma."
25
25
  else
26
- errors << "#{error(state_file_path)} an unhandled error occured: #{e.inspect}"
26
+ errors << "#{red(state_file_path)} an unhandled error occured: #{e.inspect}"
27
27
  end
28
28
  nil
29
29
  rescue Errno::EISDIR => e
30
30
  if e.message =~ /#{state_file_path}/
31
- errors << "#{warn(state_file_path)} isn't a state file"
31
+ errors << "#{yellow(state_file_path)} isn't a state file"
32
32
  else
33
- errors << "#{error(state_file_path)} an unhandled error occured: #{e.inspect}"
33
+ errors << "#{red(state_file_path)} an unhandled error occured: #{e.inspect}"
34
34
  end
35
35
  nil
36
36
  rescue => e
37
- errors << "#{error(state_file_path)} an unhandled error occured: #{e.inspect}"
37
+ errors << "#{red(state_file_path)} an unhandled error occured: #{e.inspect}"
38
38
  nil
39
39
  end
40
40
  end
data/lib/stats.rb CHANGED
@@ -154,4 +154,10 @@ class Stats
154
154
  def load
155
155
  running_threads/total_threads.to_f*100
156
156
  end
157
+
158
+ def version
159
+ return nil unless @stats.key?('versions')
160
+
161
+ "#{@stats['versions']['puma']}/#{@stats['versions']['ruby']['engine']}#{@stats['versions']['ruby']['version']}p#{@stats['versions']['ruby']['patchlevel']}"
162
+ end
157
163
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma-status
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.4'
4
+ version: '1.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoann Lecuyer
@@ -119,14 +119,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: 2.3.0
122
+ version: 2.5.0
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
125
  - - ">="
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 3.0.0
129
+ rubygems_version: 3.4.0.dev
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: Command-line tool for puma to display information about running request/process