kubernetes-health 3.3.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/kubernetes/health/version.rb +1 -1
- data/lib/puma/kubernetes/app.rb +18 -2
- data/lib/puma/kubernetes/parser.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b50f5907432e2efafb49e0541ff792e1bfb086e0b5ced6f2c21308a20cf5e1e0
|
4
|
+
data.tar.gz: 2ca4a7a600c71caf1704272c95bbb7d2c354d0bdd32e1eee778f10b39043ea90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d633dc94b6e18c839cdb0658efc6fbcb3d924b73dc8fb23a14bdb4b6babcdd856d5ee6f0eccd2cd4bae24272b97678d5fab4fee4154493c1a11a196a37532a57
|
7
|
+
data.tar.gz: c49e6472031a756436d3f17d6c3b1f2a736c3dcbdd1c63c13c0f980e200eff31d217bb44d48f8901eaecc90d75daef74c9a2261c0816e245977afa2755dd4c64
|
data/README.md
CHANGED
data/lib/puma/kubernetes/app.rb
CHANGED
@@ -27,8 +27,12 @@ module Puma
|
|
27
27
|
http_code = i_am_ready ? 200 : 503
|
28
28
|
when ::Kubernetes::Health::Config.route_metrics
|
29
29
|
http_code = 200
|
30
|
-
|
31
|
-
|
30
|
+
if ::Kubernetes::Health::Config.response_format == 'json'
|
31
|
+
content = include_puma_key_prefix(include_usage(JSON.parse(@launcher.stats))).to_json
|
32
|
+
else
|
33
|
+
@parser.parse include_usage(JSON.parse(@launcher.stats))
|
34
|
+
content = Prometheus::Client::Formats::Text.marshal(Prometheus::Client.registry)
|
35
|
+
end
|
32
36
|
else
|
33
37
|
http_code = 404
|
34
38
|
end
|
@@ -39,6 +43,18 @@ module Puma
|
|
39
43
|
::Kubernetes::Health::Config.request_log_callback.call(req, http_code, content)
|
40
44
|
[http_code, type, [content]]
|
41
45
|
end
|
46
|
+
|
47
|
+
def include_usage(stats)
|
48
|
+
stats['usage'] = (1 - stats['pool_capacity'].to_f / stats['max_threads']).round(2)
|
49
|
+
stats
|
50
|
+
end
|
51
|
+
def include_puma_key_prefix(stats)
|
52
|
+
result = {}
|
53
|
+
stats.each do |k,v|
|
54
|
+
result["puma_#{k}"] = v
|
55
|
+
end
|
56
|
+
result
|
57
|
+
end
|
42
58
|
end
|
43
59
|
end
|
44
60
|
end
|
@@ -29,6 +29,7 @@ module Puma
|
|
29
29
|
registry.gauge(:puma_pool_capacity, 'Number of allocatable worker threads', index: 0)
|
30
30
|
registry.gauge(:puma_max_threads, 'Maximum number of worker threads', index: 0)
|
31
31
|
registry.gauge(:puma_workers, 'Number of configured workers').set({}, 1)
|
32
|
+
registry.gauge(:puma_usage, 'Result of (1 - puma_pool_capacity/puma_max_threads)', index: 0)
|
32
33
|
end
|
33
34
|
|
34
35
|
def registry
|