fluent-plugin-kinesis-modified 3.1.4 → 3.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5eb2e11af14feafefd700f1cdccbf3e2db10d83
4
- data.tar.gz: c439a086a1cd5fdcfab0134c70737c80f4fcc833
3
+ metadata.gz: 7765915d41361a75eb09b522c3fa44d5dbf9b8a3
4
+ data.tar.gz: f282294b383621d02a469b1c12f5785d82afce3f
5
5
  SHA512:
6
- metadata.gz: f2a8c698e569f3aa524c1b11a9f5b9140340532d06bc94b051474920993b4922f16c124bfb29f1f102e83764bd0d3f880720983ddb4ae6b3806056fe33000bed
7
- data.tar.gz: 7c7f1c908d027e9e787e65f5c6c9e921aa76382ad14d2ef36ae86a4e2ae09564af9ed07627cd57b6fa6497182741b50bf54866623f6b61730b82b09000ff71dd
6
+ metadata.gz: 8d91bc03c04ae38fae648a33cac55fd609b18ea55d79959a72199bbd98073198103a1f85025a9e790f325c67b424294dd494558036cc5429220a6188b747cd8b
7
+ data.tar.gz: 4a5f7325bd584c9e2e9d585d18fb60a69b18ba5f3c9ad8039f81d6d2fca37f669b5bd0ebac4e7aeaf1c365529fde94c5506189e7fb499739be1f81cb4441e6ad
@@ -72,12 +72,14 @@ module Fluent
72
72
 
73
73
  config_param :debug, :bool, default: false
74
74
  config_param :max_records_per_call, :integer, default: 128
75
+ config_param :max_request_size, :integer, default: 4*1024
75
76
 
76
77
  helpers :formatter, :inject
77
78
 
78
79
  def configure(conf)
79
80
  super
80
81
  @data_formatter = data_formatter_create(conf)
82
+ @max_request_size *= 1024
81
83
  end
82
84
 
83
85
  def multi_workers_ready?
@@ -151,20 +153,24 @@ module Fluent
151
153
  chunk.open do |io|
152
154
  records = msgpack_unpacker(io).to_enum
153
155
  batches = []
154
- sizes = []
156
+ batches_size = 0
155
157
  split_to_batches(records) do |batch, size|
156
- batches << batch
157
- sizes << size
158
- end
159
- (0..batches.size).step(@max_records_per_call) do |i|
160
- batches_slice = batches[i..i+@max_records_per_call-1]
161
- size = sizes[i..i+@max_records_per_call-1].inject(:+)
162
- batches_size = batches_slice.map(&:size).inject(:+)
163
- if not size.nil?
164
- log.debug(sprintf "Write chunk %s / %3d batches / %3d records / %4d KB", unique_id, batches_slice.size, batches_size, size/1024)
165
- batch_request_with_retry(batches_slice, &block)
158
+ if (batches.size+1 > @max_records_per_call or batches_size+size > @max_request_size) and batches.size > 0
159
+ records_number = batches.map(&:size).inject(:+)
160
+ log.debug(sprintf "Write chunk %s / %3d batches / %3d records / %4d KB", unique_id, batches.size, records_number, batches_size/1024)
161
+ batch_request_with_retry(batches, &block)
166
162
  log.debug("Finish writing chunk")
163
+ batches = []
164
+ batches_size = 0
167
165
  end
166
+ batches << batch
167
+ batches_size += size
168
+ end
169
+ if batches.size > 0
170
+ records_number = batches.map(&:size).inject(:+)
171
+ log.debug(sprintf "Write chunk %s / %3d batches / %3d records / %4d KB", unique_id, batches.size, records_number, batches_size/1024)
172
+ batch_request_with_retry(batches, &block)
173
+ log.debug("Finish writing chunk")
168
174
  end
169
175
  end
170
176
  end
@@ -13,5 +13,5 @@
13
13
  # language governing permissions and limitations under the License.
14
14
 
15
15
  module FluentPluginKinesis
16
- VERSION = '3.1.4'
16
+ VERSION = '3.1.5'
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-kinesis-modified
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - iHandy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-13 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -305,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
305
  version: '0'
306
306
  requirements: []
307
307
  rubyforge_project:
308
- rubygems_version: 2.5.2
308
+ rubygems_version: 2.5.2.3
309
309
  signing_key:
310
310
  specification_version: 4
311
311
  summary: Fluentd output plugin that sends events to Amazon Kinesis. Forked from fluent-plugin-kinesis