Class: Deimos::Utils::LagReporter::ConsumerGroup
- Inherits:
-
Object
- Object
- Deimos::Utils::LagReporter::ConsumerGroup
- Defined in:
- lib/deimos/utils/lag_reporter.rb
Overview
Class that has a list of topics
Instance Attribute Summary collapse
Instance Method Summary collapse
- #assign_lag(topic, partition, lag) ⇒ Object
-
#compute_lag(topic, partition, offset) ⇒ Object
Figure out the current lag by asking Kafka based on the current offset.
-
#initialize(id) ⇒ ConsumerGroup
constructor
A new instance of ConsumerGroup.
- #report_lag(topic, partition) ⇒ Object
Constructor Details
#initialize(id) ⇒ ConsumerGroup
Returns a new instance of ConsumerGroup.
20 21 22 23 |
# File 'lib/deimos/utils/lag_reporter.rb', line 20 def initialize(id) self.id = id self.topics = {} end |
Instance Attribute Details
#id ⇒ String
17 18 19 |
# File 'lib/deimos/utils/lag_reporter.rb', line 17 def id @id end |
#topics ⇒ Hash<String, Topic>
15 16 17 |
# File 'lib/deimos/utils/lag_reporter.rb', line 15 def topics @topics end |
Instance Method Details
#assign_lag(topic, partition, lag) ⇒ Object
35 36 37 38 |
# File 'lib/deimos/utils/lag_reporter.rb', line 35 def assign_lag(topic, partition, lag) self.topics[topic.to_s] ||= Topic.new(topic, self) self.topics[topic.to_s].assign_lag(partition, lag) end |
#compute_lag(topic, partition, offset) ⇒ Object
Figure out the current lag by asking Kafka based on the current offset.
44 45 46 47 |
# File 'lib/deimos/utils/lag_reporter.rb', line 44 def compute_lag(topic, partition, offset) self.topics[topic.to_s] ||= Topic.new(topic, self) self.topics[topic.to_s].compute_lag(partition, offset) end |
#report_lag(topic, partition) ⇒ Object
27 28 29 30 |
# File 'lib/deimos/utils/lag_reporter.rb', line 27 def report_lag(topic, partition) self.topics[topic.to_s] ||= Topic.new(topic, self) self.topics[topic.to_s].report_lag(partition) end |