puma-status 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/core.rb +6 -1
- data/lib/stats.rb +15 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f327ff6c023bad34b7c01a219db11210cebad0bf54406a128968217603021fec
|
4
|
+
data.tar.gz: e5cf7266ef9680ca884ff82614a9855738a368acb1702b2dc79a1ed3bcadb8bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e483270e101d60a19402fbab29ee6165fbc1db1c5a7920a857e2a90611f7f09f0dddf366a3aedbc83d9d933af085ae823502491f8444d44501d8d8a63beed0c
|
7
|
+
data.tar.gz: 173715cae769db0f9d58ca25c4eb7c64a3fc96d203824eef9f2620d16a2483105273f9e7a3176bc9684d37b73a8a46993708833b870ed2e08f02c7279e1ef1a0
|
data/lib/core.rb
CHANGED
@@ -43,12 +43,17 @@ def hydrate_stats(stats, puma_state, state_file_path)
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def display_stats(stats)
|
46
|
-
|
46
|
+
master_line = "#{stats.pid} (#{stats.state_file_path}) Uptime: #{seconds_to_human(stats.uptime)} "
|
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))}"
|
49
|
+
|
50
|
+
puts master_line
|
47
51
|
|
48
52
|
stats.workers.each do |wstats|
|
49
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))}"
|
50
54
|
worker_line += " #{("Queue: " + wstats.backlog.to_s).colorize(:red)}" if wstats.backlog > 0
|
51
55
|
worker_line += " Last checkin: #{wstats.last_checkin}" if wstats.last_checkin >= 10
|
56
|
+
worker_line += " Phase: #{wstats.phase}" if wstats.phase != stats.phase
|
52
57
|
|
53
58
|
puts worker_line
|
54
59
|
end
|
data/lib/stats.rb
CHANGED
@@ -30,12 +30,20 @@ class Stats
|
|
30
30
|
end
|
31
31
|
alias :total_threads :running
|
32
32
|
|
33
|
+
def max_threads
|
34
|
+
@wstats.dig('last_status', 'max_threads') || @wstats['max_threads'] || 0
|
35
|
+
end
|
36
|
+
|
33
37
|
def pool_capacity
|
34
38
|
@wstats.dig('last_status', 'pool_capacity') || @wstats['pool_capacity'] || 0
|
35
39
|
end
|
36
40
|
|
37
41
|
def running_threads
|
38
|
-
|
42
|
+
max_threads - pool_capacity
|
43
|
+
end
|
44
|
+
|
45
|
+
def phase
|
46
|
+
@wstats['phase']
|
39
47
|
end
|
40
48
|
|
41
49
|
def load
|
@@ -88,11 +96,11 @@ class Stats
|
|
88
96
|
end
|
89
97
|
|
90
98
|
def total_threads
|
91
|
-
workers.reduce(0) { |total, wstats| total + wstats.
|
99
|
+
workers.reduce(0) { |total, wstats| total + wstats.max_threads }
|
92
100
|
end
|
93
101
|
|
94
102
|
def running_threads
|
95
|
-
workers.reduce(0) { |total, wstats| total +
|
103
|
+
workers.reduce(0) { |total, wstats| total + wstats.running_threads }
|
96
104
|
end
|
97
105
|
|
98
106
|
def running
|
@@ -103,6 +111,10 @@ class Stats
|
|
103
111
|
@stats['pool_capacity'] || 0
|
104
112
|
end
|
105
113
|
|
114
|
+
def phase
|
115
|
+
@stats['phase']
|
116
|
+
end
|
117
|
+
|
106
118
|
def load
|
107
119
|
running_threads/total_threads.to_f*100
|
108
120
|
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.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoann Lecuyer
|
@@ -112,9 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
|
116
|
-
rubygems_version: 2.7.6.2
|
115
|
+
rubygems_version: 3.0.3
|
117
116
|
signing_key:
|
118
117
|
specification_version: 4
|
119
|
-
summary: Command-line
|
118
|
+
summary: Command-line tool for puma to display information about running request/process
|
120
119
|
test_files: []
|