Class: Karafka::Web::Management::Migrations::ConsumersMetrics::FillMissingReceivedAndSentBytes

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/management/migrations/consumers_metrics/1699543515_fill_missing_received_and_sent_bytes.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



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

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