From 2ed6e9165d1b9806996ad70f4ee1fa58c91a8e72 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Sun, 3 Jun 2018 14:37:47 +0300 Subject: Generalise stats counters Related to PR #1333 by @gs-kamnas --- lib/oxidized/node/stats.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/node/stats.rb b/lib/oxidized/node/stats.rb index 17b9a13..e37e07a 100644 --- a/lib/oxidized/node/stats.rb +++ b/lib/oxidized/node/stats.rb @@ -14,11 +14,7 @@ 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 + @stats[:counter][job.status] += 1 end # @param [Symbol] status stats for specific status @@ -31,8 +27,7 @@ module Oxidized def initialize @stats = {} - @stats[:success_count] = 0 - @stats[:failure_count] = 0 + @stats[:counter] = Hash.new 0 end end end -- cgit v1.2.1