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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2fdcd9559b7c9d9d40b8908d4ec47ef17ff63d62305832bbe7f69b10b05a35b
4
- data.tar.gz: 0560305f80f5d1f5aea6eb5959ef7ebb3cc225479492a69594bf227d618804f1
3
+ metadata.gz: 666536fd481e1b7dbd4a1425eac6da54aa29a67a9e3cc6247b63de0752accf67
4
+ data.tar.gz: 4c06d6e51d8b60d10be5f2f126c65bd0d2cba9a815192c1c0ab7a37edd148974
5
5
  SHA512:
6
- metadata.gz: 82be9fdd64b14e11e3ff0ff0d927b2508129eb0a84d5a5a4340c7afd991273ddd83f114f6ffdfb1d2add0e84a9526ba8ccd727887ecf70d694f4fb8cc2a0e053
7
- data.tar.gz: 53d7ee213ff018c23a7df00df47d8a3cf8525bb475a9eafb4415ee8ba9ffc4db3c2c22dbc48711f06fa2a390ef1f92a3fbf215451a2460022d34e3f23174bf79
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
@@ -1,3 +1,3 @@
1
1
  module Detector
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: detector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel