Class: TingYun::Agent::Collector::StatsEngine

Inherits:
Object
  • Object
show all
Includes:
MetricStats
Defined in:
lib/ting_yun/agent/collector/stats_engine.rb,
lib/ting_yun/agent/collector/stats_engine/metric_stats.rb

Overview

This class handles all the statistics gathering for the agent

Defined Under Namespace

Modules: MetricStats

Constant Summary

Constants included from MetricStats

MetricStats::SCOPE_PLACEHOLDER

Instance Method Summary collapse

Methods included from MetricStats

#coerce_to_metric_spec_array, #harvest!, #merge!, #merge_transaction_metrics!, #record_scoped_and_unscoped_metrics, #record_unscoped_metrics, #reset!, #reset_stats, #tl_record_scoped_and_unscoped_metrics, #tl_record_unscoped_metrics, #to_h

Constructor Details

#initializeStatsEngine

Returns a new instance of StatsEngine.



15
16
17
18
# File 'lib/ting_yun/agent/collector/stats_engine.rb', line 15

def initialize
  @stats_lock = Mutex.new
  @stats_hash = StatsHash.new
end

Instance Method Details

#with_stats_lockObject

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



22
23
24
# File 'lib/ting_yun/agent/collector/stats_engine.rb', line 22

def with_stats_lock
  @stats_lock.synchronize { yield }
end