diff options
Diffstat (limited to 'lib/oxidized/node/stats.rb')
-rw-r--r-- | lib/oxidized/node/stats.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/oxidized/node/stats.rb b/lib/oxidized/node/stats.rb index 6b5719c..17b9a13 100644 --- a/lib/oxidized/node/stats.rb +++ b/lib/oxidized/node/stats.rb @@ -14,11 +14,16 @@ module Oxidized @stats[job.status] ||= [] @stats[job.status].shift if @stats[job.status].size > MAX_STAT @stats[job.status].push stat + if job.status.equal? :success + @stats[:success_count] += 1 + else + @stats[:failure_count] += 1 + end end # @param [Symbol] status stats for specific status # @return [Hash,Array] Hash of stats for every status or Array of stats for specific status - def get status=nil + def get status = nil status ? @stats[status] : @stats end @@ -26,8 +31,9 @@ module Oxidized def initialize @stats = {} + @stats[:success_count] = 0 + @stats[:failure_count] = 0 end - end end end |