Sha256: 710a484d3c991ad61bcd3a73b8afff41e692f8737560c7fed5eb03da07f65c77

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Management
      module Migrations
        # Since we have introduced notion of pause listeners, we need to reflect this in the
        # UI, so the scaling changes are visible
        class SplitListenersIntoActiveAndPausedInMetrics < Base
          self.versions_until = '1.1.2'
          self.type = :consumers_metrics

          # @param state [Hash]
          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
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
karafka-web-0.9.1 lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb
karafka-web-0.9.0 lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb
karafka-web-0.9.0.rc3 lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb
karafka-web-0.9.0.rc2 lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb
karafka-web-0.9.0.rc1 lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb
karafka-web-0.8.2 lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb
karafka-web-0.8.1 lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb
karafka-web-0.8.0 lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb
karafka-web-0.8.0.rc1 lib/karafka/web/management/migrations/1704722380_split_listeners_into_active_and_paused_in_metrics.rb