puma-status 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/core.rb +2 -2
  3. data/lib/stats.rb +4 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f327ff6c023bad34b7c01a219db11210cebad0bf54406a128968217603021fec
4
- data.tar.gz: e5cf7266ef9680ca884ff82614a9855738a368acb1702b2dc79a1ed3bcadb8bd
3
+ metadata.gz: 3ca2fb63b6be20e85ac281783c213be6227b29a268d98c743ebf5f15c8ce57af
4
+ data.tar.gz: 6ba41b60919c9271d47e1e1e94e4d3a951b49f413e51a7a85f9a8fc26bce1d5b
5
5
  SHA512:
6
- metadata.gz: 1e483270e101d60a19402fbab29ee6165fbc1db1c5a7920a857e2a90611f7f09f0dddf366a3aedbc83d9d933af085ae823502491f8444d44501d8d8a63beed0c
7
- data.tar.gz: 173715cae769db0f9d58ca25c4eb7c64a3fc96d203824eef9f2620d16a2483105273f9e7a3176bc9684d37b73a8a46993708833b870ed2e08f02c7279e1ef1a0
6
+ metadata.gz: 8233f7045c47ff7172990686b5be21178d0b2df078001ddad38572aeafd8127e2a5d0dc70604f75676a58e59fdcd2139674b2f7aa970e169e2f471b833c9af69
7
+ data.tar.gz: 0ce03ee787e21a2b5f49a69d4d28089429a0f95fd993dadbb897e90883315c4bc93f2790e3490640362d0cd14c8f982618a8176e7b2111ebb1aca8630655dfe3
data/lib/core.rb CHANGED
@@ -45,12 +45,12 @@ end
45
45
  def display_stats(stats)
46
46
  master_line = "#{stats.pid} (#{stats.state_file_path}) Uptime: #{seconds_to_human(stats.uptime)} "
47
47
  master_line += "| Phase: #{stats.phase} " if stats.phase
48
- master_line += "| Load: #{color(75, 50, stats.load, asciiThreadLoad(stats.running_threads, stats.total_threads))}"
48
+ master_line += "| Load: #{color(75, 50, stats.load, asciiThreadLoad(stats.running_threads, stats.max_threads))}"
49
49
 
50
50
  puts master_line
51
51
 
52
52
  stats.workers.each do |wstats|
53
- 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)} | Load: #{color(75, 50, wstats.load, asciiThreadLoad(wstats.running_threads, wstats.total_threads))}"
53
+ 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)} | Load: #{color(75, 50, wstats.load, asciiThreadLoad(wstats.running_threads, wstats.max_threads))}"
54
54
  worker_line += " #{("Queue: " + wstats.backlog.to_s).colorize(:red)}" if wstats.backlog > 0
55
55
  worker_line += " Last checkin: #{wstats.last_checkin}" if wstats.last_checkin >= 10
56
56
  worker_line += " Phase: #{wstats.phase}" if wstats.phase != stats.phase
data/lib/stats.rb CHANGED
@@ -103,6 +103,10 @@ class Stats
103
103
  workers.reduce(0) { |total, wstats| total + wstats.running_threads }
104
104
  end
105
105
 
106
+ def max_threads
107
+ workers.reduce(0) { |total, wstats| total + wstats.max_threads }
108
+ end
109
+
106
110
  def running
107
111
  @stats['running'] || 0
108
112
  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: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoann Lecuyer