Module: NulogyMessageBusConsumer::Tasks::LogConsumerLag::Calculator

Defined in:
lib/nulogy_message_bus_consumer/tasks/log_consumer_lag.rb

Class Method Summary collapse

Class Method Details

.add_max_lag(lag_by_topic) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/nulogy_message_bus_consumer/tasks/log_consumer_lag.rb', line 37

def self.add_max_lag(lag_by_topic)
  lag_by_topic.each_value do |lag_by_partition|
    lag_by_partition[:_max] = lag_by_partition.values.max || 0
  end

  lag_by_topic[:_max] = lag_by_topic
    .map { |_topic, lag_by_partition| lag_by_partition[:_max] }
    .max || 0

  lag_by_topic
end