yabeda-puma-plugin 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f94f38e97079338e19849ddc164b859f9ea221d1842347f86d25e4809b507615
|
4
|
+
data.tar.gz: 5fec9afef71af361875885ad5dd6006d49518d5fb9d5582f89883453a6539752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c554a0d7a13f92c6e1d64741e1a03295901f0562d8f49e3f3dedf5d828eac484e1f23083842a21f40f5002d11357d7bf52f3efada435a21e7d676fd5a02e5b5
|
7
|
+
data.tar.gz: f468a304b54fefbe4f2b5585259ddcf15088c4f0a993a8da9ff9a0b0f5646e25da67ea9b8aae861c93546b65e147101682d7bc60d02f97829a796e1ae73bdc1c
|
data/lib/puma/plugin/yabeda.rb
CHANGED
@@ -14,14 +14,14 @@ Puma::Plugin.create do
|
|
14
14
|
|
15
15
|
Yabeda.configure do
|
16
16
|
group :puma
|
17
|
-
|
18
|
-
gauge :backlog, comment: 'Number of established but unaccepted connections in the backlog'
|
19
|
-
gauge :running, comment: 'Number of running worker threads'
|
20
|
-
gauge :pool_capacity, comment: 'Number of allocatable worker threads'
|
21
|
-
gauge :max_threads, comment: 'Maximum number of worker threads'
|
22
|
-
gauge :workers, comment: 'Number of configured workers'
|
17
|
+
|
18
|
+
gauge :backlog, tags: %i[index], comment: 'Number of established but unaccepted connections in the backlog'
|
19
|
+
gauge :running, tags: %i[index], comment: 'Number of running worker threads'
|
20
|
+
gauge :pool_capacity, tags: %i[index], comment: 'Number of allocatable worker threads'
|
21
|
+
gauge :max_threads, tags: %i[index], comment: 'Maximum number of worker threads'
|
23
22
|
|
24
23
|
if clustered
|
24
|
+
gauge :workers, comment: 'Number of configured workers'
|
25
25
|
gauge :booted_workers, comment: 'Number of booted workers'
|
26
26
|
gauge :old_workers, comment: 'Number of old workers'
|
27
27
|
end
|
@@ -13,21 +13,33 @@ module Yabeda
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def call
|
16
|
-
|
16
|
+
[].tap { |result| parse(data, {}, result) }
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
-
def parse(stats, labels
|
21
|
+
def parse(stats, labels, result)
|
22
22
|
stats.each do |key, value|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
case key
|
24
|
+
when 'worker_status'
|
25
|
+
value.each { |s| parse(s, labels.merge(index: s['index']), result) }
|
26
|
+
when 'last_status'
|
27
|
+
parse(value, labels, result)
|
28
|
+
else
|
29
|
+
next unless metric?(key)
|
30
|
+
|
31
|
+
l = clustered_metric?(key) ? labels : { index: 0 }.merge(labels)
|
32
|
+
result << { name: key, value: value, labels: l }
|
33
|
+
end
|
26
34
|
end
|
27
35
|
end
|
28
36
|
|
29
37
|
def metric?(name)
|
30
|
-
Statistics::METRICS.include?(name.to_sym) ||
|
38
|
+
Statistics::METRICS.include?(name.to_sym) || clustered_metric?(name)
|
39
|
+
end
|
40
|
+
|
41
|
+
def clustered_metric?(name)
|
42
|
+
clustered && Statistics::CLUSTERED_METRICS.include?(name.to_sym)
|
31
43
|
end
|
32
44
|
end
|
33
45
|
end
|
@@ -2,8 +2,8 @@ module Yabeda
|
|
2
2
|
module Puma
|
3
3
|
module Plugin
|
4
4
|
module Statistics
|
5
|
-
METRICS = [:backlog, :running, :pool_capacity, :max_threads
|
6
|
-
CLUSTERED_METRICS = [:booted_workers, :old_workers]
|
5
|
+
METRICS = [:backlog, :running, :pool_capacity, :max_threads]
|
6
|
+
CLUSTERED_METRICS = [:booted_workers, :old_workers, :workers]
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
data/yabeda-puma-plugin.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_runtime_dependency "yabeda"
|
24
|
+
spec.add_runtime_dependency "yabeda", "~> 0.2"
|
25
25
|
spec.add_runtime_dependency "puma"
|
26
26
|
spec.add_runtime_dependency "json"
|
27
27
|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda-puma-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salahutdinov Dmitry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yabeda
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '0.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: puma
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|