Module: Fluent::Plugin::KinesisHelper::API::BatchRequest

Defined Under Namespace

Modules: BatchRequestParams Classes: Backoff

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



49
50
51
# File 'lib/fluent/plugin/kinesis_helper/api.rb', line 49

def self.included(mod)
  mod.include BatchRequestParams
end

Instance Method Details

#configure(conf) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fluent/plugin/kinesis_helper/api.rb', line 53

def configure(conf)
  super
  if @batch_request_max_count.nil?
    @batch_request_max_count = self.class::BatchRequestLimitCount
  elsif @batch_request_max_count > self.class::BatchRequestLimitCount
    raise ConfigError, "batch_request_max_count can't be grater than #{self.class::BatchRequestLimitCount}."
  end
  if @size_kb_per_record.nil?
    @size_kb_per_record = self.class::BatchRequestLimitSize
  else
    @size_kb_per_record *= 1024
    if @size_kb_per_record > self.class::BatchRequestLimitSize
      raise ConfigError, "size_kb_per_record can't be grater than #{self.class::BatchRequestLimitSize}."
    end
  end
end

#size_of_values(record) ⇒ Object



70
71
72
# File 'lib/fluent/plugin/kinesis_helper/api.rb', line 70

def size_of_values(record)
  record.compact.map(&:size).inject(:+) || 0
end