Class: Jetmeter::LabelAccumulator

Inherits:
Object
  • Object
show all
Defined in:
lib/jetmeter/label_accumulator.rb

Constant Summary collapse

LABELED_EVENT =
'labeled'.freeze
UNLABELED_EVENT =
'unlabeled'.freeze
CORRESPONDING_EVENTS_LIMIT =
15
MAX_LABEL_CHANGE_TIME =
60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(additive: true) ⇒ LabelAccumulator

Returns a new instance of LabelAccumulator.



10
11
12
13
# File 'lib/jetmeter/label_accumulator.rb', line 10

def initialize(additive: true)
  @corresponding_events = { LABELED_EVENT => [], UNLABELED_EVENT => [] }
  @additive = additive
end

Instance Attribute Details

#additiveObject (readonly)

Returns the value of attribute additive.



8
9
10
# File 'lib/jetmeter/label_accumulator.rb', line 8

def additive
  @additive
end

Instance Method Details

#valid?(event, flow) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
# File 'lib/jetmeter/label_accumulator.rb', line 15

def valid?(event, flow)
  return false unless event.issue_event?

  store_corresponding_event(event)
  labeling_transition?(flow, event) || unlabeling_transition?(flow, event)
end