Class: TingYun::Agent::TransactionMetrics
- Inherits:
-
Object
- Object
- TingYun::Agent::TransactionMetrics
- Defined in:
- lib/ting_yun/agent/transaction/transaction_metrics.rb
Constant Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #_record_metrics(names, value, aux, target, &blk) ⇒ Object
- #each_scoped ⇒ Object
- #each_unscoped ⇒ Object
- #has_key?(key) ⇒ Boolean
-
#initialize ⇒ TransactionMetrics
constructor
A new instance of TransactionMetrics.
- #record_scoped(names, value = nil, aux = nil, &blk) ⇒ Object
- #record_unscoped(names, value = nil, aux = nil, &blk) ⇒ Object
Constructor Details
#initialize ⇒ TransactionMetrics
Returns a new instance of TransactionMetrics.
9 10 11 12 |
# File 'lib/ting_yun/agent/transaction/transaction_metrics.rb', line 9 def initialize @unscoped = Hash.new(&DEFAULT_PROC) @scoped = Hash.new(&DEFAULT_PROC) end |
Instance Method Details
#[](key) ⇒ Object
26 27 28 |
# File 'lib/ting_yun/agent/transaction/transaction_metrics.rb', line 26 def [](key) @unscoped[key] end |
#_record_metrics(names, value, aux, target, &blk) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ting_yun/agent/transaction/transaction_metrics.rb', line 38 def _record_metrics(names, value, aux, target, &blk) # This looks dumb, but we're avoiding an extra Array allocation. case names when Array names.each do |name| target[name].record(value, aux, &blk) end else target[names].record(value, aux, &blk) end end |
#each_scoped ⇒ Object
34 35 36 |
# File 'lib/ting_yun/agent/transaction/transaction_metrics.rb', line 34 def each_scoped @scoped.each { |name, stats| yield name, stats } end |
#each_unscoped ⇒ Object
30 31 32 |
# File 'lib/ting_yun/agent/transaction/transaction_metrics.rb', line 30 def each_unscoped @unscoped.each { |name, stats| yield name, stats } end |
#has_key?(key) ⇒ Boolean
22 23 24 |
# File 'lib/ting_yun/agent/transaction/transaction_metrics.rb', line 22 def has_key?(key) @unscoped.has_key?(key) end |
#record_scoped(names, value = nil, aux = nil, &blk) ⇒ Object
14 15 16 |
# File 'lib/ting_yun/agent/transaction/transaction_metrics.rb', line 14 def record_scoped(names, value=nil, aux=nil, &blk) _record_metrics(names, value, aux, @scoped, &blk) end |
#record_unscoped(names, value = nil, aux = nil, &blk) ⇒ Object
18 19 20 |
# File 'lib/ting_yun/agent/transaction/transaction_metrics.rb', line 18 def record_unscoped(names, value=nil, aux=nil, &blk) _record_metrics(names, value, aux, @unscoped, &blk) end |