Class: Atatus::Collector::TxnHist

Inherits:
Object
  • Object
show all
Defined in:
lib/atatus/collector/hist.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#histObject (readonly)

Returns the value of attribute hist.



12
13
14
# File 'lib/atatus/collector/hist.rb', line 12

def hist
  @hist
end

#kindObject (readonly)

Returns the value of attribute kind.



12
13
14
# File 'lib/atatus/collector/hist.rb', line 12

def kind
  @kind
end

#typeObject (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