Method: Sensu::Server::Process#prune_check_result_aggregations
- Defined in:
- lib/sensu/server/process.rb
#prune_check_result_aggregations ⇒ Object
Prune check result aggregations (aggregates). Sensu only stores the 20 latest aggregations for a check, to keep the amount of data stored to a minimum.
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 |
# File 'lib/sensu/server/process.rb', line 721 def prune_check_result_aggregations @logger.info("pruning check result aggregations") @redis.smembers("aggregates") do |checks| checks.each do |check_name| @redis.smembers("aggregates:#{check_name}") do |aggregates| if aggregates.size > 20 aggregates.sort! aggregates.take(aggregates.size - 20).each do |check_issued| @redis.srem("aggregates:#{check_name}", check_issued) do result_set = "#{check_name}:#{check_issued}" @redis.del("aggregate:#{result_set}") do @redis.del("aggregation:#{result_set}") do @logger.debug("pruned aggregation", { :check => { :name => check_name, :issued => check_issued } }) end end end end end end end end end |