lib/scout_rails/store.rb in scout_rails-1.0.8 vs lib/scout_rails/store.rb in scout_rails-1.0.9

- old
+ new

@@ -1,8 +1,12 @@ # The store encapsolutes the logic that (1) saves instrumented data by Metric name to memory and (2) maintains a stack (just an Array) # of instrumented methods that are being called. It's accessed via +ScoutRails::Agent.instance.store+. class ScoutRails::Store + + # Limits the size of the metric hash to prevent a metric explosion. + MAX_SIZE = 1000 + attr_accessor :metric_hash attr_accessor :transaction_hash attr_accessor :stack attr_accessor :sample attr_reader :transaction_sample_lock @@ -140,10 +144,10 @@ # Combines old and current data def merge_data(old_data) old_data.each do |old_meta,old_stats| if stats = metric_hash[old_meta] metric_hash[old_meta] = stats.combine!(old_stats) - else + elsif metric_hash.size < MAX_SIZE metric_hash[old_meta] = old_stats end end metric_hash end \ No newline at end of file