fluent-plugin-kinesis-modified 3.1.3

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.
@@ -0,0 +1,59 @@
1
+ #
2
+ # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # may not use this file except in compliance with the License. A copy of
6
+ # the License is located at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is
11
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # ANY KIND, either express or implied. See the License for the specific
13
+ # language governing permissions and limitations under the License.
14
+
15
+ require 'fluent/plugin/kinesis'
16
+
17
+ module Fluent
18
+ module Plugin
19
+ class KinesisFirehoseOutput < KinesisOutput
20
+ Fluent::Plugin.register_output('kinesis_firehose', self)
21
+
22
+ RequestType = :firehose
23
+ BatchRequestLimitCount = 500
24
+ BatchRequestLimitSize = 4 * 1024 * 1024
25
+ include KinesisHelper::API::BatchRequest
26
+
27
+ config_param :delivery_stream_name, :string
28
+ config_param :append_new_line, :bool, default: true
29
+
30
+ def configure(conf)
31
+ super
32
+ if @append_new_line
33
+ org_data_formatter = @data_formatter
34
+ @data_formatter = ->(tag, time, record) {
35
+ org_data_formatter.call(tag, time, record).chomp + "\n"
36
+ }
37
+ end
38
+ end
39
+
40
+ def format(tag, time, record)
41
+ format_for_api do
42
+ [@data_formatter.call(tag, time, record)]
43
+ end
44
+ end
45
+
46
+ def write(chunk)
47
+ write_records_batch(chunk) do |batch|
48
+ records = batch.map{|(data)|
49
+ { data: data }
50
+ }
51
+ client.put_record_batch(
52
+ delivery_stream_name: @delivery_stream_name,
53
+ records: records,
54
+ )
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,71 @@
1
+ #
2
+ # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # may not use this file except in compliance with the License. A copy of
6
+ # the License is located at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is
11
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # ANY KIND, either express or implied. See the License for the specific
13
+ # language governing permissions and limitations under the License.
14
+
15
+ require 'fluent/plugin/kinesis'
16
+
17
+ module Fluent
18
+ module Plugin
19
+ class KinesisStreamsOutput < KinesisOutput
20
+ Fluent::Plugin.register_output('kinesis_streams', self)
21
+
22
+ RequestType = :streams
23
+ BatchRequestLimitCount = 500
24
+ BatchRequestLimitSize = 5 * 1024 * 1024
25
+ include KinesisHelper::API::BatchRequest
26
+
27
+ config_param :stream_name, :string
28
+ config_param :partition_key, :string, default: nil
29
+
30
+ def configure(conf)
31
+ super
32
+ @key_formatter = key_formatter_create
33
+ end
34
+
35
+ def format(tag, time, record)
36
+ format_for_api do
37
+ data = @data_formatter.call(tag, time, record)
38
+ key = @key_formatter.call(record)
39
+ [data, key]
40
+ end
41
+ end
42
+
43
+ def write(chunk)
44
+ write_records_batch(chunk) do |batch|
45
+ records = batch.map{|(data, partition_key)|
46
+ { data: data, partition_key: partition_key }
47
+ }
48
+ client.put_records(
49
+ stream_name: @stream_name,
50
+ records: records,
51
+ )
52
+ end
53
+ end
54
+
55
+ private
56
+
57
+ def key_formatter_create
58
+ if @partition_key.nil?
59
+ ->(record) { SecureRandom.hex(16) }
60
+ else
61
+ ->(record) {
62
+ if !record.key?(@partition_key)
63
+ raise KeyNotFoundError.new(@partition_key, record)
64
+ end
65
+ record[@partition_key]
66
+ }
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,78 @@
1
+ #
2
+ # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # may not use this file except in compliance with the License. A copy of
6
+ # the License is located at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is
11
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # ANY KIND, either express or implied. See the License for the specific
13
+ # language governing permissions and limitations under the License.
14
+
15
+ require 'fluent/plugin/kinesis'
16
+ require 'fluent/plugin/kinesis_helper/aggregator'
17
+
18
+ module Fluent
19
+ module Plugin
20
+ class KinesisStreamsAggregatedOutput < KinesisOutput
21
+ Fluent::Plugin.register_output('kinesis_streams_aggregated', self)
22
+ include KinesisHelper::Aggregator::Mixin
23
+
24
+ RequestType = :streams_aggregated
25
+ BatchRequestLimitCount = 100_000
26
+ BatchRequestLimitSize = 1024 * 1024
27
+ include KinesisHelper::API::BatchRequest
28
+
29
+ config_param :stream_name, :string
30
+ config_param :fixed_partition_key, :string, default: nil
31
+
32
+ def configure(conf)
33
+ super
34
+ @partition_key_generator = create_partition_key_generator
35
+ @size_kb_per_record -= offset
36
+ @max_record_size -= offset
37
+ end
38
+
39
+ def format(tag, time, record)
40
+ format_for_api do
41
+ [@data_formatter.call(tag, time, record)]
42
+ end
43
+ end
44
+
45
+ def write(chunk)
46
+ write_records_batch(chunk) do |batch|
47
+ key = @partition_key_generator.call
48
+ records = batch.map{|(data)|data}
49
+ client.put_records(
50
+ stream_name: @stream_name,
51
+ records: [{
52
+ partition_key: key,
53
+ data: aggregator.aggregate(records, key),
54
+ }],
55
+ )
56
+ end
57
+ end
58
+
59
+ def offset
60
+ @offset ||= AggregateOffset + @partition_key_generator.call.size*2
61
+ end
62
+
63
+ private
64
+
65
+ def size_of_values(record)
66
+ super(record) + RecordOffset
67
+ end
68
+
69
+ def create_partition_key_generator
70
+ if @fixed_partition_key.nil?
71
+ ->() { SecureRandom.hex(16) }
72
+ else
73
+ ->() { @fixed_partition_key }
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,83 @@
1
+ #
2
+ # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # may not use this file except in compliance with the License. A copy of
6
+ # the License is located at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is
11
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # ANY KIND, either express or implied. See the License for the specific
13
+ # language governing permissions and limitations under the License.
14
+
15
+ require 'fluent/plugin/kinesis'
16
+ require 'fluent/plugin/kinesis_helper/aggregator'
17
+
18
+ module Fluent
19
+ module Plugin
20
+ class KinesisStreamsAggregatedOutput < KinesisOutput
21
+ Fluent::Plugin.register_output('kinesis_streams_aggregated_modified', self)
22
+ include KinesisHelper::Aggregator::Mixin
23
+
24
+ RequestType = :streams_aggregated
25
+ BatchRequestLimitCount = 100_000
26
+ BatchRequestLimitSize = 1024 * 1024
27
+ include KinesisHelper::API::BatchRequest
28
+
29
+ config_param :stream_name, :string
30
+ config_param :fixed_partition_key, :string, default: nil
31
+
32
+ def configure(conf)
33
+ super
34
+ @partition_key_generator = create_partition_key_generator
35
+ @size_kb_per_record -= offset
36
+ @max_record_size -= offset
37
+ end
38
+
39
+ def format(tag, time, record)
40
+ format_for_api do
41
+ [@data_formatter.call(tag, time, record)]
42
+ end
43
+ end
44
+
45
+ def write(chunk)
46
+ write_records_batch2(chunk) do |batches|
47
+ records_to_send = []
48
+ batches.each do |batch|
49
+ key = @partition_key_generator.call
50
+ records = batch.map{|(data)|data}
51
+ regularized_agg_record = {
52
+ partition_key: key,
53
+ data: aggregator.aggregate(records, key)
54
+ }
55
+ records_to_send << regularized_agg_record
56
+ end
57
+ client.put_records(
58
+ stream_name: @stream_name,
59
+ records: records_to_send
60
+ )
61
+ end
62
+ end
63
+
64
+ def offset
65
+ @offset ||= AggregateOffset + @partition_key_generator.call.size*2
66
+ end
67
+
68
+ private
69
+
70
+ def size_of_values(record)
71
+ super(record) + RecordOffset
72
+ end
73
+
74
+ def create_partition_key_generator
75
+ if @fixed_partition_key.nil?
76
+ ->() { SecureRandom.hex(16) }
77
+ else
78
+ ->() { @fixed_partition_key }
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,17 @@
1
+ #
2
+ # Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # may not use this file except in compliance with the License. A copy of
6
+ # the License is located at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is
11
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # ANY KIND, either express or implied. See the License for the specific
13
+ # language governing permissions and limitations under the License.
14
+
15
+ module FluentPluginKinesis
16
+ VERSION = '3.1.3'
17
+ end
metadata ADDED
@@ -0,0 +1,313 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-kinesis-modified
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.1.3
5
+ platform: ruby
6
+ authors:
7
+ - iHandy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-07-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fluentd
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.14.10
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.14.10
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
33
+ - !ruby/object:Gem::Dependency
34
+ name: aws-sdk-kinesis
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1'
40
+ - - "!="
41
+ - !ruby/object:Gem::Version
42
+ version: '1.4'
43
+ - - "!="
44
+ - !ruby/object:Gem::Version
45
+ version: '1.5'
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1'
53
+ - - "!="
54
+ - !ruby/object:Gem::Version
55
+ version: '1.4'
56
+ - - "!="
57
+ - !ruby/object:Gem::Version
58
+ version: '1.5'
59
+ - !ruby/object:Gem::Dependency
60
+ name: aws-sdk-firehose
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - "~>"
64
+ - !ruby/object:Gem::Version
65
+ version: '1'
66
+ - - "!="
67
+ - !ruby/object:Gem::Version
68
+ version: '1.5'
69
+ - - "!="
70
+ - !ruby/object:Gem::Version
71
+ version: '1.9'
72
+ type: :runtime
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - "~>"
77
+ - !ruby/object:Gem::Version
78
+ version: '1'
79
+ - - "!="
80
+ - !ruby/object:Gem::Version
81
+ version: '1.5'
82
+ - - "!="
83
+ - !ruby/object:Gem::Version
84
+ version: '1.9'
85
+ - !ruby/object:Gem::Dependency
86
+ name: google-protobuf
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '3'
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '3'
99
+ - !ruby/object:Gem::Dependency
100
+ name: bundler
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '1.10'
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '1.10'
113
+ - !ruby/object:Gem::Dependency
114
+ name: rake
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '10.0'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '10.0'
127
+ - !ruby/object:Gem::Dependency
128
+ name: test-unit
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: 3.0.8
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: 3.0.8
141
+ - !ruby/object:Gem::Dependency
142
+ name: test-unit-rr
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: 1.0.3
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: 1.0.3
155
+ - !ruby/object:Gem::Dependency
156
+ name: pry
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: 0.10.1
162
+ type: :development
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: 0.10.1
169
+ - !ruby/object:Gem::Dependency
170
+ name: pry-byebug
171
+ requirement: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: 3.3.0
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: 3.3.0
183
+ - !ruby/object:Gem::Dependency
184
+ name: pry-stack_explorer
185
+ requirement: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: 0.4.9.2
190
+ type: :development
191
+ prerelease: false
192
+ version_requirements: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: 0.4.9.2
197
+ - !ruby/object:Gem::Dependency
198
+ name: net-empty_port
199
+ requirement: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: 0.0.2
204
+ type: :development
205
+ prerelease: false
206
+ version_requirements: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: 0.0.2
211
+ - !ruby/object:Gem::Dependency
212
+ name: mocha
213
+ requirement: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ version: 1.1.0
218
+ type: :development
219
+ prerelease: false
220
+ version_requirements: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: 1.1.0
225
+ - !ruby/object:Gem::Dependency
226
+ name: webmock
227
+ requirement: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - ">="
230
+ - !ruby/object:Gem::Version
231
+ version: 1.24.2
232
+ type: :development
233
+ prerelease: false
234
+ version_requirements: !ruby/object:Gem::Requirement
235
+ requirements:
236
+ - - ">="
237
+ - !ruby/object:Gem::Version
238
+ version: 1.24.2
239
+ - !ruby/object:Gem::Dependency
240
+ name: fakefs
241
+ requirement: !ruby/object:Gem::Requirement
242
+ requirements:
243
+ - - ">="
244
+ - !ruby/object:Gem::Version
245
+ version: 0.8.1
246
+ type: :development
247
+ prerelease: false
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ requirements:
250
+ - - ">="
251
+ - !ruby/object:Gem::Version
252
+ version: 0.8.1
253
+ description:
254
+ email:
255
+ executables: []
256
+ extensions: []
257
+ extra_rdoc_files: []
258
+ files:
259
+ - ".github/PULL_REQUEST_TEMPLATE.md"
260
+ - ".gitignore"
261
+ - ".travis.yml"
262
+ - CHANGELOG.md
263
+ - CODE_OF_CONDUCT.md
264
+ - CONTRIBUTING.md
265
+ - CONTRIBUTORS.txt
266
+ - Gemfile
267
+ - LICENSE.txt
268
+ - Makefile
269
+ - NOTICE.txt
270
+ - README.md
271
+ - Rakefile
272
+ - benchmark/task.rake
273
+ - fluent-plugin-kinesis.gemspec
274
+ - gemfiles/Gemfile.fluentd-0.14.10
275
+ - gemfiles/Gemfile.td-agent-3.1.1
276
+ - gemfiles/Gemfile.td-agent-3.2.0
277
+ - gemfiles/Gemfile.td-agent-3.2.1
278
+ - gemfiles/Gemfile.td-agent-3.3.0
279
+ - lib/fluent/plugin/kinesis.rb
280
+ - lib/fluent/plugin/kinesis_helper/aggregator.rb
281
+ - lib/fluent/plugin/kinesis_helper/api.rb
282
+ - lib/fluent/plugin/kinesis_helper/client.rb
283
+ - lib/fluent/plugin/out_kinesis_firehose.rb
284
+ - lib/fluent/plugin/out_kinesis_streams.rb
285
+ - lib/fluent/plugin/out_kinesis_streams_aggregated.rb
286
+ - lib/fluent/plugin/out_kinesis_streams_aggregated_modified.rb
287
+ - lib/fluent_plugin_kinesis/version.rb
288
+ homepage: https://github.com/BlackNight95/aws-fluent-plugin-kinesis/tree/feature_modified_aggregation
289
+ licenses:
290
+ - Apache-2.0
291
+ metadata: {}
292
+ post_install_message:
293
+ rdoc_options: []
294
+ require_paths:
295
+ - lib
296
+ required_ruby_version: !ruby/object:Gem::Requirement
297
+ requirements:
298
+ - - ">="
299
+ - !ruby/object:Gem::Version
300
+ version: '2.1'
301
+ required_rubygems_version: !ruby/object:Gem::Requirement
302
+ requirements:
303
+ - - ">="
304
+ - !ruby/object:Gem::Version
305
+ version: '0'
306
+ requirements: []
307
+ rubyforge_project:
308
+ rubygems_version: 2.5.2.3
309
+ signing_key:
310
+ specification_version: 4
311
+ summary: Fluentd output plugin that sends events to Amazon Kinesis. Forked from fluent-plugin-kinesis
312
+ version 3.1.0
313
+ test_files: []