Class: Karafka::Web::Management::Migrations::SplitListenersIntoActiveAndPausedInMetrics
- Inherits:
-
Base
- Object
- Base
- Karafka::Web::Management::Migrations::SplitListenersIntoActiveAndPausedInMetrics
- Defined in:
- lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb
Overview
Since we have introduced notion of pause listeners, we need to reflect this in the UI, so the scaling changes are visible
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 |
# File 'lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb', line 14 def migrate(state) state[:aggregated].each_value do |metrics| metrics.each do |metric| listeners = if metric.last.key?(:listeners) metric.last[:listeners].to_i elsif metric.last.key?(:listeners_count) metric.last[:listeners_count].to_i else 0 end metric.last[:listeners] = { active: listeners, standby: 0 } end end end |