beanpool 0.1.8 → 0.1.9

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
  SHA1:
3
- metadata.gz: 4d4160a86836f9eee120d3eeaebef6008cb06d83
4
- data.tar.gz: d1cd55d8af1f209cf21490a4f587cd119d6548ad
3
+ metadata.gz: 2be9c997d937fe769d9be68925d185528015bde8
4
+ data.tar.gz: af21307cde08fb39b73f2998ec524ddc7c069824
5
5
  SHA512:
6
- metadata.gz: 9471b130f5d5230b8346eab341ffb87f88167ba9d2b9475010e866cc0e5b172e228317f16f2ad593a3c8f7b11c5a794aec3390f8293707dad69714c84033b16e
7
- data.tar.gz: 0adc7de6f975b6d7be3e863cf1acd84010fb3ac44329c03b65fa241ba74a01d29554f4e231f95724d46051e75c1f708c3b3493162fae658958d7e569ed1bd8b5
6
+ metadata.gz: 73b2fc7bacf31885e5d101187a77d3c3824153a17a8e5166ab9d849f4001bbbbe917c21ad000f1095f8e2dc87e5d83028b1b48b0e9b4be18492898e71c290491
7
+ data.tar.gz: 073383c828ceb4e01939efdc708f17bfb1e3798f8a727ffe4aa191a1b4236fc520c8ceb62fd7e92f881ec207df35b42a79739b36f60543125f88cf5fed5f9be7
@@ -22,8 +22,8 @@ class Beanpool
22
22
  @connections.close
23
23
  end
24
24
 
25
- def stats
26
- { not_implemented: true }
25
+ def stats(tube_name)
26
+ @connections.all_stats(tube_name)
27
27
  rescue => ex
28
28
  BlitlineLogger.log(ex)
29
29
  return {}
@@ -131,6 +131,23 @@ class Beanpool
131
131
  new_hash
132
132
  end
133
133
 
134
+ def all_stats(tube_name)
135
+ return_struct = {}
136
+ @connections.each do |ip, connection|
137
+ stat = connection.tubes[tube_name].stats
138
+ stat.to_h.each do |name, val|
139
+ return_struct[name] = if val.is_a?(Integer)
140
+ return_struct[name].nil? ? val.to_i : return_struct[name] + val.to_i
141
+ elsif name == "name"
142
+ return_struct[name].nil? ? ip.to_s : return_struct[name] + "|" + ip.to_s
143
+ else
144
+ return_struct[name].nil? ? val.to_s : return_struct[name] + "|" + val.to_s
145
+ end
146
+ end
147
+ end
148
+ return return_struct
149
+ end
150
+
134
151
  def stats(tube_name, stat_name)
135
152
  value = 0
136
153
  @connections.each do |_k, v|
@@ -1,3 +1,3 @@
1
1
  class Beanpool
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beanpool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason M.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-19 00:00:00.000000000 Z
11
+ date: 2018-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler