summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2018-06-03 14:37:47 +0300
committerSaku Ytti <saku@ytti.fi>2018-06-03 14:37:47 +0300
commit2ed6e9165d1b9806996ad70f4ee1fa58c91a8e72 (patch)
tree647113f4f03202c7da5bc7d215b7152d9e5adcd0 /lib
parent2a8e0e6bde27cb85cd24542cf434169fd828d239 (diff)
Generalise stats counters
Related to PR #1333 by @gs-kamnas
Diffstat (limited to 'lib')
-rw-r--r--lib/oxidized/node/stats.rb9
1 files changed, 2 insertions, 7 deletions
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