Class: Karafka::Pro::Instrumentation::Callbacks::ConsumerGroups::Decorator

Inherits:
Instrumentation::Callbacks::ConsumerGroups::Decorator show all
Defined in:
lib/karafka/pro/instrumentation/callbacks/consumer_groups/decorator.rb

Overview

Pro statistics decorator for consumer groups. On top of the standard decoration (deltas, freeze durations) it invokes Pro statistics enrichments, each encapsulated in its own component with a #call entrypoint. Currently: the lag compensation of long-paused partitions.

Instance Method Summary collapse

Constructor Details

#initializeDecorator

Returns a new instance of Decorator.



43
44
45
46
# File 'lib/karafka/pro/instrumentation/callbacks/consumer_groups/decorator.rb', line 43

def initialize
  super
  @lag_compensator = Pro::Instrumentation::ConsumerGroups::LagCompensation::Compensator.new
end

Instance Method Details

#call(statistics) ⇒ Hash

Note:

When the lag compensation is disabled, its refresher is not subscribed and the registry stays empty, so the compensation is a pass-through by itself

Returns decorated statistics with the Pro enrichments applied.

Parameters:

  • statistics (Hash)

    raw librdkafka statistics

Returns:

  • (Hash)

    decorated statistics with the Pro enrichments applied



53
54
55
56
57
# File 'lib/karafka/pro/instrumentation/callbacks/consumer_groups/decorator.rb', line 53

def call(statistics)
  @lag_compensator.call(statistics)

  super
end