summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2018-06-03 15:03:36 +0300
committerSaku Ytti <saku@ytti.fi>2018-06-03 15:03:36 +0300
commit8d93ecc5230917861d7a5d3495e049f3ddc10161 (patch)
tree19995764c1dc47c4d8d27784f95db86519ae24cd /lib
parent2ed6e9165d1b9806996ad70f4ee1fa58c91a8e72 (diff)
fix tests
Diffstat (limited to 'lib')
-rw-r--r--lib/oxidized/node/stats.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/oxidized/node/stats.rb b/lib/oxidized/node/stats.rb
index e37e07a..c20a91a 100644
--- a/lib/oxidized/node/stats.rb
+++ b/lib/oxidized/node/stats.rb
@@ -23,6 +23,18 @@ module Oxidized
status ? @stats[status] : @stats
end
+ def get_counter counter=nil
+ counter ? @stats[:counter][counter] : @stats[:counter]
+ end
+
+ def successes
+ @stats[:counter][:success]
+ end
+
+ def failures
+ @stats[:counter].reduce(0) { |m,h| h[0] == :success ? m : m+h[1] }
+ end
+
private
def initialize