Class: Karafka::Web::Management::Migrations::FillMissingReceivedAndSentBytesInConsumersMetrics

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/management/migrations/1699543515_fill_missing_received_and_sent_bytes_in_consumers_metrics.rb

Overview

Adds bytes_sent and bytes_received to all the aggregated metrics samples, so we have charts that do not have to fill gaps or check anything

Instance Method Summary collapse

Methods inherited from Base

applicable?, index, migrate, sorted_descendants

Instance Method Details

#migrate(state) ⇒ Object

Parameters:

  • state (Hash)

    metrics state



14
15
16
17
18
19
20
21
# File 'lib/karafka/web/management/migrations/1699543515_fill_missing_received_and_sent_bytes_in_consumers_metrics.rb', line 14

def migrate(state)
  state[:aggregated].each_value do |metrics|
    metrics.each do |metric|
      metric.last[:bytes_sent] = 0
      metric.last[:bytes_received] = 0
    end
  end
end