Class: Karafka::Web::Processing::Consumers::Aggregators::State::Steps::IncrementCounters

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/processing/consumers/aggregators/state/steps/increment_counters.rb

Overview

Increments the total counters based on the provided report.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Karafka::Web::Processing::Consumers::Aggregators::State::Steps::Base

Instance Method Details

#callObject

Increments context.state[:stats] totals from context.report[:stats][:total]



13
14
15
16
17
18
# File 'lib/karafka/web/processing/consumers/aggregators/state/steps/increment_counters.rb', line 13

def call
  context.report[:stats][:total].each do |key, value|
    context.state[:stats][key] ||= 0
    context.state[:stats][key] += value
  end
end