diff options
author | Saku Ytti <saku@ytti.fi> | 2018-06-12 18:39:05 +0300 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2018-06-12 18:39:05 +0300 |
commit | 219c4527ab0bab5243e5a979e1c8eb6126fcd128 (patch) | |
tree | 554a7330708d19e3cb17a28a06ccc3f1b7b9fb73 /lib/oxidized/node | |
parent | da9be642cc26cfa82358eb88c537e79715c75680 (diff) |
allow configurable history size in stats
Diffstat (limited to 'lib/oxidized/node')
-rw-r--r-- | lib/oxidized/node/stats.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/oxidized/node/stats.rb b/lib/oxidized/node/stats.rb index e50f799..6ea8985 100644 --- a/lib/oxidized/node/stats.rb +++ b/lib/oxidized/node/stats.rb @@ -13,7 +13,7 @@ module Oxidized :time => job.time, } @stats[job.status] ||= [] - @stats[job.status].shift if @stats[job.status].size > MAX_STAT + @stats[job.status].shift if @stats[job.status].size > @history_size @stats[job.status].push stat @stats[:counter][job.status] += 1 end @@ -48,7 +48,8 @@ module Oxidized private def initialize - @mtimes = Array.new(MAX_STAT, "unknown") + @history_size = Oxidized.config.stats.history_size? || MAX_STAT + @mtimes = Array.new(@history_size, "unknown") @stats = {} @stats[:counter] = Hash.new 0 end |