detector 0.4.0 → 0.5.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 +4 -4
- data/bin/detector +5 -0
- data/lib/detector/base.rb +13 -0
- data/lib/detector/version.rb +1 -1
- 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: 666536fd481e1b7dbd4a1425eac6da54aa29a67a9e3cc6247b63de0752accf67
|
4
|
+
data.tar.gz: 4c06d6e51d8b60d10be5f2f126c65bd0d2cba9a815192c1c0ab7a37edd148974
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14bdd91ff681914a3158dea8798e0a70c8ecc947e9a4be4172bdefb89996dcf3e658127d3d2251481b6f1ae6eaf749a60d152e524c2f4cccaee8135fd12eb68f
|
7
|
+
data.tar.gz: 28f3d5e64a8bec859a00bba960f5772289f9511d00c7106889b54dfd411428400b06ef3dcc4dce494c0216bc0a4fa929ae266c01239768a0e4e7c1bbc1d9e77c
|
data/bin/detector
CHANGED
@@ -23,6 +23,11 @@ puts "Detected: #{detector.kind}"
|
|
23
23
|
puts "Version: #{detector.version}"
|
24
24
|
puts "Host: #{detector.host}:#{detector.port}"
|
25
25
|
|
26
|
+
if detector.connection_count && detector.connection_limit
|
27
|
+
usage = detector.connection_usage_percentage
|
28
|
+
puts "Connections: #{detector.connection_count}/#{detector.connection_limit} (#{usage}%)"
|
29
|
+
end
|
30
|
+
|
26
31
|
if detector.respond_to?(:replication_available?) && !detector.replication_available?.nil?
|
27
32
|
puts "Replication: #{detector.replication_available? ? 'Available' : 'Not available'}"
|
28
33
|
end
|
data/lib/detector/base.rb
CHANGED
@@ -219,5 +219,18 @@ module Detector
|
|
219
219
|
def replication_available?
|
220
220
|
nil
|
221
221
|
end
|
222
|
+
|
223
|
+
def connection_count
|
224
|
+
nil
|
225
|
+
end
|
226
|
+
|
227
|
+
def connection_limit
|
228
|
+
nil
|
229
|
+
end
|
230
|
+
|
231
|
+
def connection_usage_percentage
|
232
|
+
return nil unless connection_count && connection_limit && connection_limit > 0
|
233
|
+
(connection_count.to_f / connection_limit.to_f * 100).round(1)
|
234
|
+
end
|
222
235
|
end
|
223
236
|
end
|
data/lib/detector/version.rb
CHANGED