class TingYun::Agent::Collector::StatsEngine

This class handles all the statistics gathering for the agent

Attributes

base_quantile_hash[R]

Public Class Methods

new() click to toggle source
# File lib/ting_yun/agent/collector/stats_engine.rb, line 17
def initialize
  @stats_lock = Mutex.new
  @stats_hash = StatsHash.new
  @base_quantile_hash = BaseQuantileHash.new
end

Public Instance Methods

record_base_quantile(hash) click to toggle source
# File lib/ting_yun/agent/collector/stats_engine.rb, line 29
def record_base_quantile(hash)
  with_stats_lock do
    @base_quantile_hash.merge!(hash)
  end
end
with_stats_lock() { || ... } click to toggle source

All access to the @stats_hash ivar should be funnelled through this method to ensure thread-safety.

# File lib/ting_yun/agent/collector/stats_engine.rb, line 25
def with_stats_lock
  @stats_lock.synchronize { yield }
end