Class: Atatus::Collector::TxnHist
- Inherits:
-
Object
- Object
- Atatus::Collector::TxnHist
- Defined in:
- lib/atatus/collector/hist.rb
Instance Attribute Summary collapse
-
#hist ⇒ Object
readonly
Returns the value of attribute hist.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #aggregate!(duration) ⇒ Object
-
#initialize(type, kind, duration) ⇒ TxnHist
constructor
A new instance of TxnHist.
Constructor Details
#initialize(type, kind, duration) ⇒ TxnHist
Returns a new instance of TxnHist.
5 6 7 8 9 10 |
# File 'lib/atatus/collector/hist.rb', line 5 def initialize(type, kind, duration) @type = type @kind = kind @hist = {} @hist[find_bin duration] = 1 end |
Instance Attribute Details
#hist ⇒ Object (readonly)
Returns the value of attribute hist.
12 13 14 |
# File 'lib/atatus/collector/hist.rb', line 12 def hist @hist end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
12 13 14 |
# File 'lib/atatus/collector/hist.rb', line 12 def kind @kind end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/atatus/collector/hist.rb', line 12 def type @type end |
Instance Method Details
#aggregate!(duration) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/atatus/collector/hist.rb', line 14 def aggregate!(duration) hbin = find_bin duration if !@hist.key?(hbin) @hist[hbin] = 1 else @hist[hbin] += 1 end end |