Class: Karafka::Web::Tracking::Consumers::Sampler::Enrichers::ConsumerGroups

Inherits:
Base
  • Object
show all
Includes:
Core::Helpers::Time
Defined in:
lib/karafka/web/tracking/consumers/sampler/enrichers/consumer_groups.rb

Overview

Enriches consumer groups data with polling details and transactional consumer handling This is responsible for materializing time-based data and filling statistical gaps for transactional consumers

Instance Method Summary collapse

Constructor Details

#initialize(consumer_groups, subscription_groups) ⇒ ConsumerGroups

Returns a new instance of ConsumerGroups.

Parameters:

  • consumer_groups (Hash)

    consumer groups hash to be enriched

  • subscription_groups (Hash)

    subscription groups tracking data



17
18
19
20
21
# File 'lib/karafka/web/tracking/consumers/sampler/enrichers/consumer_groups.rb', line 17

def initialize(consumer_groups, subscription_groups)
  super()
  @consumer_groups = consumer_groups
  @subscription_groups = subscription_groups
end

Instance Method Details

#callHash

Enriches consumer groups with polling details and transactional consumer offsets

Returns:

  • (Hash)

    enriched consumer groups



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/karafka/web/tracking/consumers/sampler/enrichers/consumer_groups.rb', line 25

def call
  consumer_groups.each_value do |cg_details|
    cg_details.each do
      cg_details.fetch(:subscription_groups, {}).each do |sg_id, sg_details|
        enrich_subscription_group(sg_id, sg_details)
      end
    end
  end

  consumer_groups
end