Class: Karafka::Web::Management::Migrations::ConsumersMetrics::RenameLagTotalToLagHybrid
- Inherits:
-
Base
- Object
- Base
- Karafka::Web::Management::Migrations::ConsumersMetrics::RenameLagTotalToLagHybrid
- Defined in:
- lib/karafka/web/management/migrations/consumers_metrics/1706611396_rename_lag_total_to_lag_hybrid.rb
Overview
Renames total lag to hybrid to better represent what it is
Instance Method Summary collapse
Methods inherited from Base
applicable?, index, migrate, sorted_descendants
Instance Method Details
#migrate(state) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/karafka/web/management/migrations/consumers_metrics/1706611396_rename_lag_total_to_lag_hybrid.rb', line 14 def migrate(state) state[:aggregated].each_value do |metrics| metrics.each do |metric| metric.last[:lag_hybrid] = metric.last[:lag_total] || 0 metric.last.delete(:lag_total) end end state[:consumer_groups].each_value do |metrics| metrics.each do |metric_group| metric_group.last.each_value do |metric| metric.each_value do |sample| sample[:lag_hybrid] = sample[:lag_total] sample.delete(:lag_total) end end end end end |