Class: Atatus::Collector::Layer

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

Direct Known Subclasses

Txn

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, kind, duration) ⇒ Layer

Returns a new instance of Layer.



5
6
7
8
9
10
11
12
# File 'lib/atatus/collector/layer.rb', line 5

def initialize(type, kind, duration)
  @type = type
  @kind = kind
  @count = 1
  @min = duration
  @max = duration
  @total = duration
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



14
15
16
# File 'lib/atatus/collector/layer.rb', line 14

def count
  @count
end

#idObject

Returns the value of attribute id.



15
16
17
# File 'lib/atatus/collector/layer.rb', line 15

def id
  @id
end

#kindObject (readonly)

Returns the value of attribute kind.



14
15
16
# File 'lib/atatus/collector/layer.rb', line 14

def kind
  @kind
end

#maxObject (readonly)

Returns the value of attribute max.



14
15
16
# File 'lib/atatus/collector/layer.rb', line 14

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



14
15
16
# File 'lib/atatus/collector/layer.rb', line 14

def min
  @min
end

#pidObject

Returns the value of attribute pid.



15
16
17
# File 'lib/atatus/collector/layer.rb', line 15

def pid
  @pid
end

#totalObject (readonly)

Returns the value of attribute total.



14
15
16
# File 'lib/atatus/collector/layer.rb', line 14

def total
  @total
end

#typeObject (readonly)

Returns the value of attribute type.



14
15
16
# File 'lib/atatus/collector/layer.rb', line 14

def type
  @type
end

Class Method Details

.span_kind(value) ⇒ Object



24
25
26
# File 'lib/atatus/collector/layer.rb', line 24

def self.span_kind(value)
  return KINDS.fetch(value, value)
end

.span_type(value) ⇒ Object



28
29
30
# File 'lib/atatus/collector/layer.rb', line 28

def self.span_type(value)
  return TYPES.fetch(value, value)
end

Instance Method Details

#aggregate!(duration) ⇒ Object



17
18
19
20
21
22
# File 'lib/atatus/collector/layer.rb', line 17

def aggregate!(duration)
  @count += 1
  @min = duration if duration < @min
  @max = duration if duration > @max
  @total += duration
end