Class: Karafka::Web::Management::Migrations::ConsumersMetrics::PopulateJobsMetrics

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/management/migrations/consumers_metrics/1716218393_populate_jobs_metrics.rb

Overview

Adds the jobs metric matching batches for aggregated metrics results

Instance Method Summary collapse

Methods inherited from Base

applicable?, index, migrate, sorted_descendants

Instance Method Details

#migrate(state) ⇒ Object

Parameters:

  • state (Hash)


14
15
16
17
18
19
20
# File 'lib/karafka/web/management/migrations/consumers_metrics/1716218393_populate_jobs_metrics.rb', line 14

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