Class: Karafka::Web::Management::Migrations::ConsumersReports::AddGroupInstanceIdToSubscriptionGroups
- Inherits:
-
Base
- Object
- Base
- Karafka::Web::Management::Migrations::ConsumersReports::AddGroupInstanceIdToSubscriptionGroups
- Defined in:
- lib/karafka/web/management/migrations/consumers_reports/1765657887_add_group_instance_id_to_subscription_groups.rb
Overview
Adds the instance_id field to subscription groups
In schema versions before 1.6.0, subscription groups did not include the instance_id field which is used for static group membership tracking.
This migration ensures old reports can be processed by adding the field with false value (indicating no static membership configured).
Instance Method Summary collapse
Methods inherited from Base
applicable?, index, migrate, sorted_descendants
Instance Method Details
#migrate(report) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/karafka/web/management/migrations/consumers_reports/1765657887_add_group_instance_id_to_subscription_groups.rb', line 20 def migrate(report) consumer_groups = report[:consumer_groups] return unless consumer_groups consumer_groups.each_value do |cg_details| subscription_groups = cg_details[:subscription_groups] next unless subscription_groups subscription_groups.each_value do |sg_details| next if sg_details.key?(:instance_id) sg_details[:instance_id] = false end end end |