fluent-plugin-kinesis 3.2.2 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +46 -25
  4. data/CHANGELOG.md +21 -0
  5. data/CONTRIBUTORS.txt +2 -0
  6. data/README.md +79 -2
  7. data/fluent-plugin-kinesis.gemspec +1 -1
  8. data/gemfiles/Gemfile.fluentd-0.14.22 +0 -14
  9. data/gemfiles/Gemfile.fluentd-1.13.3 +6 -0
  10. data/gemfiles/Gemfile.td-agent-3.1.0 +0 -14
  11. data/gemfiles/Gemfile.td-agent-3.1.1 +0 -14
  12. data/gemfiles/Gemfile.td-agent-3.2.0 +0 -14
  13. data/gemfiles/Gemfile.td-agent-3.2.1 +0 -14
  14. data/gemfiles/Gemfile.td-agent-3.3.0 +0 -14
  15. data/gemfiles/Gemfile.td-agent-3.4.0 +17 -0
  16. data/gemfiles/Gemfile.td-agent-3.4.1 +0 -17
  17. data/gemfiles/Gemfile.td-agent-3.5.0 +0 -14
  18. data/gemfiles/Gemfile.td-agent-3.5.1 +0 -14
  19. data/gemfiles/Gemfile.td-agent-3.6.0 +17 -0
  20. data/gemfiles/Gemfile.td-agent-3.7.0 +17 -0
  21. data/gemfiles/Gemfile.td-agent-3.7.1 +17 -0
  22. data/gemfiles/Gemfile.td-agent-3.8.0 +17 -0
  23. data/gemfiles/Gemfile.td-agent-3.8.1 +18 -0
  24. data/gemfiles/Gemfile.td-agent-4.0.0 +25 -0
  25. data/gemfiles/Gemfile.td-agent-4.0.1 +21 -0
  26. data/gemfiles/Gemfile.td-agent-4.1.0 +21 -0
  27. data/gemfiles/Gemfile.td-agent-4.1.1 +21 -0
  28. data/gemfiles/Gemfile.td-agent-4.2.0 +21 -0
  29. data/lib/fluent/plugin/kinesis.rb +10 -8
  30. data/lib/fluent/plugin/kinesis_helper/api.rb +65 -9
  31. data/lib/fluent/plugin/kinesis_helper/client.rb +25 -0
  32. data/lib/fluent/plugin/out_kinesis_firehose.rb +3 -2
  33. data/lib/fluent/plugin/out_kinesis_streams.rb +1 -1
  34. data/lib/fluent/plugin/out_kinesis_streams_aggregated.rb +1 -1
  35. data/lib/fluent_plugin_kinesis/version.rb +1 -1
  36. metadata +15 -10
  37. data/gemfiles/Gemfile.fluentd-1.9.1 +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f410e3829237caf34033008ff210d278bd9e11e127e48f4611042065b2b5ff2
4
- data.tar.gz: 8085f421bf1ca76e6d2cbc1e91c9168ddef470427591c4e386f204f20e9214e9
3
+ metadata.gz: 90a9718baa3e6849ce6ad7be32104672dcdf8993940c71d2d9fb666ce64b35e2
4
+ data.tar.gz: 064de8d0bbe66a8b8a8f4102bb686487fc0d7294904399dd745ce641b593c9bf
5
5
  SHA512:
6
- metadata.gz: 2ea0c5855780a12ff28de449a5def77ca74b21d455a72098b2da8feb3e67847c4ceb4d562739f84dece5fa91f448d6a665838da19e539234458b3a0900bb768b
7
- data.tar.gz: '0844b285486b2bb81e5d18bed60ebdee24dce74e4a1f00a28b0d6afa8af69f6c05fa016aa884424e8e61c232dc506c53ec1bf560f3b6ab228ce5f7141e95db17'
6
+ metadata.gz: 248f0fd2de87171ea58d878de9450edf95eb1dee58e31bfaf1aa716080e3921f68aa8ebdac2cbf052759a7e4262d5e598c5380c0c75edef503c54c8e760f1d3e
7
+ data.tar.gz: 79128aa4b4d07372ecc8d53d2f7196fa442d2c7c1694e215daca6cac7aae4d097af3b0512ddeae74708c053d6fb92fdce3c87811f4c0a2f5060b2c76649597e4
data/.gitignore CHANGED
@@ -4,6 +4,7 @@
4
4
  /gemfiles/Gemfile*.lock
5
5
  /_yardoc/
6
6
  /coverage/
7
+ /vendor/
7
8
  /doc/
8
9
  /pkg/
9
10
  /spec/reports/
data/.travis.yml CHANGED
@@ -2,34 +2,55 @@ language: ruby
2
2
  os: linux
3
3
  sudo: false
4
4
 
5
- gemfile:
6
- - Gemfile
7
- - gemfiles/Gemfile.td-agent-3.5.1
8
-
9
5
  # Test with supported td-agent versions
10
- # https://support.treasuredata.com/hc/en-us/articles/360001479187-The-td-agent-ChangeLog
6
+ # https://docs.fluentd.org/quickstart/support#change-logs
7
+ # https://docs.treasuredata.com/display/public/PD/The+td-agent+Change+Log
8
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/master/CHANGELOG.md
11
9
  matrix:
12
10
  include:
13
- - rvm: 2.6.5
14
- gemfile: gemfiles/Gemfile.fluentd-1.9.1 # Latest Fluentd
15
- - rvm: 2.4.1
16
- gemfile: gemfiles/Gemfile.fluentd-0.14.22 # Oldest supported Fluentd
17
- - rvm: 2.4.2 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.1.0/config/projects/td-agent3.rb#L20
18
- gemfile: gemfiles/Gemfile.td-agent-3.1.0
19
- - rvm: 2.4.2 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.1.1/config/projects/td-agent3.rb#L17
20
- gemfile: gemfiles/Gemfile.td-agent-3.1.1
21
- - rvm: 2.4.4 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.2.0/config/projects/td-agent3.rb#L22
22
- gemfile: gemfiles/Gemfile.td-agent-3.2.0
23
- - rvm: 2.4.4 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.2.1/config/projects/td-agent3.rb#L22
24
- gemfile: gemfiles/Gemfile.td-agent-3.2.1
25
- - rvm: 2.4.5 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.3.0/config/projects/td-agent3.rb#L22
26
- gemfile: gemfiles/Gemfile.td-agent-3.3.0
27
- - rvm: 2.4.6 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.1/config/projects/td-agent3.rb#L22
28
- gemfile: gemfiles/Gemfile.td-agent-3.4.1
29
- - rvm: 2.4.6 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.5.0/config/projects/td-agent3.rb#L22
30
- gemfile: gemfiles/Gemfile.td-agent-3.5.0
31
- - rvm: 2.4.9 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.5.1/config/projects/td-agent3.rb#L22
32
- gemfile: gemfiles/Gemfile.td-agent-3.5.1
11
+ - gemfile: gemfiles/Gemfile.fluentd-1.13.3 # Latest Fluentd / https://www.fluentd.org/download
12
+ rvm: 3.0.2 # Latest supported Ruby / https://www.ruby-lang.org/en/downloads
13
+ dist: focal
14
+ - gemfile: gemfiles/Gemfile.fluentd-0.14.22 # Oldest supported Fluentd
15
+ rvm: 2.3.0 # Oldest supported Ruby
16
+ - gemfile: gemfiles/Gemfile.td-agent-3.1.0
17
+ rvm: 2.4.2 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.1.0/config/projects/td-agent3.rb#L20
18
+ # - gemfile: gemfiles/Gemfile.td-agent-3.1.1
19
+ # rvm: 2.4.2 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.1.1/config/projects/td-agent3.rb#L17
20
+ # - gemfile: gemfiles/Gemfile.td-agent-3.2.0
21
+ # rvm: 2.4.4 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.2.0/config/projects/td-agent3.rb#L22
22
+ - gemfile: gemfiles/Gemfile.td-agent-3.2.1
23
+ rvm: 2.4.4 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.2.1/config/projects/td-agent3.rb#L22
24
+ - gemfile: gemfiles/Gemfile.td-agent-3.3.0
25
+ rvm: 2.4.5 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.3.0/config/projects/td-agent3.rb#L22
26
+ # - gemfile: gemfiles/Gemfile.td-agent-3.4.0
27
+ # rvm: 2.4.5 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.0/config/projects/td-agent3.rb#L22
28
+ - gemfile: gemfiles/Gemfile.td-agent-3.4.1
29
+ rvm: 2.4.6 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.1/config/projects/td-agent3.rb#L22
30
+ # - gemfile: gemfiles/Gemfile.td-agent-3.5.0
31
+ # rvm: 2.4.6 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.5.0/config/projects/td-agent3.rb#L22
32
+ - gemfile: gemfiles/Gemfile.td-agent-3.5.1
33
+ rvm: 2.4.9 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.5.1/config/projects/td-agent3.rb#L22
34
+ - gemfile: gemfiles/Gemfile.td-agent-3.6.0
35
+ rvm: 2.4.9 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.6.0/config/projects/td-agent3.rb#L22
36
+ # - gemfile: gemfiles/Gemfile.td-agent-3.7.0
37
+ # rvm: 2.4.9 # https://github.com/treasure-data/omnibus-td-agent/commit/da5cb39ec5396f652cd30bad5bb8ef4ec19071a9#diff-f73e763ace61e7c4bf48bf94bd6e295bc2cfd1ce5f9e38a4d19e266353e37498R22
38
+ - gemfile: gemfiles/Gemfile.td-agent-3.7.1
39
+ rvm: 2.4.10 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.7.1/config/projects/td-agent3.rb#L22
40
+ - gemfile: gemfiles/Gemfile.td-agent-3.8.0 # Latest official release of td-agent v3
41
+ rvm: 2.4.10 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.8.0/config/projects/td-agent3.rb#L22
42
+ - gemfile: gemfiles/Gemfile.td-agent-3.8.1 # Maintenance release of td-agent v3
43
+ rvm: 2.4.10 # https://github.com/treasure-data/omnibus-td-agent/pull/273/files#diff-f73e763ace61e7c4bf48bf94bd6e295bc2cfd1ce5f9e38a4d19e266353e37498R22
44
+ # - gemfile: gemfiles/Gemfile.td-agent-4.0.0
45
+ # rvm: 2.7.1 # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/41b3436d43c21e48a9cf34c58ae640f0e3dfb44c/td-agent/config.rb#L16
46
+ - gemfile: gemfiles/Gemfile.td-agent-4.0.1
47
+ rvm: 2.7.1 # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.0.1/td-agent/config.rb#L16
48
+ # - gemfile: gemfiles/Gemfile.td-agent-4.1.0
49
+ # rvm: 2.7.2 # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.1.0/td-agent/config.rb#L19
50
+ - gemfile: gemfiles/Gemfile.td-agent-4.1.1
51
+ rvm: 2.7.3 # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.1.1/td-agent/config.rb#L17
52
+ - gemfile: gemfiles/Gemfile.td-agent-4.2.0
53
+ rvm: 2.7.4 # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.2.0/td-agent/config.rb#L21
33
54
  fast_finish: true
34
55
 
35
56
  script: bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.4.1
4
+
5
+ - Enhancement - Add stream name to debug logs to identify : [#214](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/214)
6
+ - Enhancement - Add td-agent 4.1.1, 4.2.0 and Fluentd 1.13.3 with Ruby 3.0.2 to test cases
7
+
8
+ ## 3.4.0
9
+
10
+ - Enhancement - Enable to monitor batch request failure and retries : [#150](https://github.com/awslabs/aws-fluent-plugin-kinesis/issues/150) [#211](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/211)
11
+ - Enhancement - Make sleep reliable by measuring actual slept time : [#162](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/162)
12
+ - Enhancement - Add td-agent 4.1.0 and Fluentd 1.12.3 to test cases
13
+
14
+ ## 3.3.0
15
+
16
+ - Feature - Add web_identity_credentials configuration for IRSA : [#208](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/208) [#209](https://github.com/awslabs/aws-fluent-plugin-kinesis/issues/209)
17
+ - Enhancement - Remove strict gem pinning of google-protobuf to support Ruby 2.7 : [#199](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/199) [#206](https://github.com/awslabs/aws-fluent-plugin-kinesis/issues/206)
18
+ - Enhancement - Add td-agent v4 (4.0.1) and Fluentd 1.11.2 to test cases
19
+
20
+ ## 3.2.3
21
+
22
+ - Enhancement - Add placeholder support for delivery_stream_name of kinesis_firehose : [#203](https://github.com/awslabs/aws-fluent-plugin-kinesis/issues/203) [#204](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/204)
23
+
3
24
  ## 3.2.2
4
25
 
5
26
  - Enhancement - Make more strict gem pinning to deal with google-protobuf requiring Ruby 2.5+ : [#199](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/199)
data/CONTRIBUTORS.txt CHANGED
@@ -4,3 +4,5 @@ to the Fluent Plugin for Amazon Kinesis Streams and Amazon Kinesis Firehose. Giv
4
4
  Genki Sugawara
5
5
  sgwr_dts@yahoo.co.jp
6
6
  https://github.com/winebarrel
7
+ https://github.com/adammw
8
+ https://github.com/cosmo0920
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Fluent plugin for Amazon Kinesis
2
2
 
3
- [![Gitter](https://badges.gitter.im/awslabs/aws-fluent-plugin-kinesis.svg)](https://gitter.im/awslabs/aws-fluent-plugin-kinesis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
4
- [![Build Status](https://travis-ci.org/awslabs/aws-fluent-plugin-kinesis.svg?branch=master)](https://travis-ci.org/awslabs/aws-fluent-plugin-kinesis)
3
+ [![Build Status](https://api.travis-ci.com/awslabs/aws-fluent-plugin-kinesis.svg?branch=master)](https://app.travis-ci.com/github/awslabs/aws-fluent-plugin-kinesis)
5
4
  [![Gem Version](https://badge.fury.io/rb/fluent-plugin-kinesis.svg)](https://rubygems.org/gems/fluent-plugin-kinesis)
6
5
  [![Gem Downloads](https://img.shields.io/gem/dt/fluent-plugin-kinesis.svg)](https://rubygems.org/gems/fluent-plugin-kinesis)
7
6
 
@@ -186,6 +185,50 @@ It should be added to assume_role_credentials configuration stanza in the next f
186
185
 
187
186
  STS API endpoint url. This can be used to override the default global STS API endpoint of sts.amazonaws.com. Using regional endpoints may be preferred to reduce latency, and are required if utilizing a PrivateLink VPC Endpoint for STS API calls.
188
187
 
188
+
189
+ ### web_identity_credentials
190
+
191
+ Similar to the assume_role_credentials, but for usage in EKS.
192
+
193
+ <match *>
194
+ @type kinesis_streams
195
+
196
+ <web_identity_credentials>
197
+ role_arn ROLE_ARN
198
+ role_session_name ROLE_SESSION_NAME
199
+ web_identity_token_file AWS_WEB_IDENTITY_TOKEN_FILE
200
+ </web_identity_credentials>
201
+ </match>
202
+
203
+ See also:
204
+
205
+ * [Using IAM Roles - AWS Identity and Access Management](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html)
206
+ * [IAM Roles For Service Accounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html)
207
+ * [Aws::STS::Client](http://docs.aws.amazon.com/sdkforruby/api/Aws/STS/Client.html)
208
+ * [Aws::AssumeRoleWebIdentityCredentials](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/AssumeRoleWebIdentityCredentials.html)
209
+
210
+ **role_arn (required)**
211
+
212
+ The Amazon Resource Name (ARN) of the role to assume.
213
+
214
+ **role_session_name (required)**
215
+
216
+ An identifier for the assumed role session.
217
+
218
+ **web_identity_token_file (required)**
219
+
220
+ The absolute path to the file on disk containing the OIDC token
221
+
222
+ **policy**
223
+
224
+ An IAM policy in JSON format.
225
+
226
+ **duration_seconds**
227
+
228
+ The duration, in seconds, of the role session. The value can range from
229
+ 900 seconds (15 minutes) to 43200 seconds (12 hours). By default, the value
230
+ is set to 3600 seconds (1 hour).
231
+
189
232
  ### instance_profile_credentials
190
233
 
191
234
  Retrieve temporary security credentials via HTTP request. This is useful on EC2 instance.
@@ -365,6 +408,16 @@ Default:
365
408
  - `kinesis_firehose`: 4 MB
366
409
  - `kinesis_streams_aggregated`: 1 MB
367
410
 
411
+ ### drop_failed_records_after_batch_request_retries
412
+ Boolean, default `true`.
413
+
414
+ If *drop_failed_records_after_batch_request_retries* is enabled (default), the plugin will drop failed records when batch request fails after retrying max times configured as *retries_on_batch_request*. This dropping can be monitored from [monitor_agent](https://docs.fluentd.org/input/monitor_agent) or [fluent-plugin-prometheus](https://docs.fluentd.org/monitoring-fluentd/monitoring-prometheus) as *retry_count* or *num_errors* metrics.
415
+
416
+ If *drop_failed_records_after_batch_request_retries* is disabled, the plugin will raise error and return chunk to Fluentd buffer when batch request fails after retrying max times. Fluentd will retry to send chunk records according to retry config in [Buffer Section](https://docs.fluentd.org/configuration/buffer-section). Note that this retryng may create duplicate records since [PutRecords API](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecords.html) of Kinesis Data Streams and [PutRecordBatch API](https://docs.aws.amazon.com/firehose/latest/APIReference/API_PutRecordBatch.html) of Kinesis Data Firehose may return a partially successful response.
417
+
418
+ ### monitor_num_of_batch_request_retries
419
+ Boolean, default `false`. If enabled, the plugin will increment *retry_count* monitoring metrics after internal retrying to send batch request. This configuration enables you to monitor [ProvisionedThroughputExceededException](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecords.html) from [monitor_agent](https://docs.fluentd.org/input/monitor_agent) or [fluent-plugin-prometheus](https://docs.fluentd.org/monitoring-fluentd/monitoring-prometheus). Note that *retry_count* metrics will be counted by the plugin in addition to original Fluentd buffering mechanism if *monitor_num_of_batch_request_retries* is enabled.
420
+
368
421
  ## Configuration: kinesis_streams
369
422
  Here are `kinesis_streams` specific configurations.
370
423
 
@@ -404,6 +457,30 @@ Here are `kinesis_firehose` specific configurations.
404
457
  ### delivery_stream_name
405
458
  Name of the delivery stream to put data.
406
459
 
460
+ As of Fluentd v1, built-in placeholders are supported. Now, you can also use built-in placeholders for this parameter.
461
+
462
+ **NOTE:**
463
+ Built-in placeholders require target key information in your buffer section attributes.
464
+
465
+ e.g.)
466
+
467
+ When you specify the following `delivery_stream_name` configuration with built-in placeholder:
468
+
469
+ ```aconf
470
+ delivery_stream_name "${$.kubernetes.annotations.kinesis_firehose_streams}"
471
+ ```
472
+
473
+ you ought to specify the corresponding attributes in buffer section:
474
+
475
+ ```aconf
476
+ # $.kubernetes.annotations.kinesis_firehose_streams needs to be set in buffer attributes
477
+ <buffer $.kubernetes.annotations.kinesis_firehose_streams>
478
+ # ...
479
+ </buffer>
480
+ ```
481
+
482
+ For more details, refer [Placeholders section in the official Fluentd document](https://docs.fluentd.org/configuration/buffer-section#placeholders).
483
+
407
484
  ### append_new_line
408
485
  Boolean. Default `true`. If it is enabled, the plugin adds new line character (`\n`) to each serialized record.
409
486
  Before appending `\n`, plugin calls chomp and removes separator from the end of each record as [chomp_record](#chomp_record) is `true`. Therefore, you don't need to enable [chomp_record](#chomp_record) option when you use [kinesis_firehose](#kinesis_firehose) output with default configuration ([append_new_line](#append_new_line) is `true`). If you want to set [append_new_line](#append_new_line) `false`, you can choose [chomp_record](#chomp_record) `false` (default) or `true` (compatible format with plugin v2).
@@ -55,7 +55,7 @@ Gem::Specification.new do |spec|
55
55
  # https://github.com/aws/aws-sdk-ruby/commit/e26577d2a426a4be79cd2d9edc1a4a4176e388ba#diff-10f50e27b30c3dc522b3c25db5782e2e
56
56
  spec.add_dependency "aws-sdk-firehose", "~> 1", "!= 1.5", "!= 1.9", "!= 1.15"
57
57
 
58
- spec.add_dependency "google-protobuf", "~> 3", "< 3.12"
58
+ spec.add_dependency "google-protobuf", "~> 3"
59
59
 
60
60
  spec.add_development_dependency "bundler", ">= 1.10"
61
61
  spec.add_development_dependency "rake", ">= 10.0"
@@ -1,17 +1,3 @@
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
1
  source 'https://rubygems.org'
16
2
 
17
3
  # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ gem "fluentd", "1.13.3"
@@ -1,17 +1,3 @@
1
- #
2
- # Copyright 2014-2019 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
1
  source 'https://rubygems.org'
16
2
 
17
3
  # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
@@ -1,17 +1,3 @@
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
1
  source 'https://rubygems.org'
16
2
 
17
3
  # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
@@ -1,17 +1,3 @@
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
1
  source 'https://rubygems.org'
16
2
 
17
3
  # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
@@ -1,17 +1,3 @@
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
1
  source 'https://rubygems.org'
16
2
 
17
3
  # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
@@ -1,17 +1,3 @@
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
1
  source 'https://rubygems.org'
16
2
 
17
3
  # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v3.4.0
7
+ # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.0/config/projects/td-agent3.rb#L27
8
+ gem "fluentd", "1.4.2"
9
+ # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.0/plugin_gems.rb#L16-L23
10
+ gem "jmespath", "1.4.0"
11
+ gem "aws-partitions", "1.149.0"
12
+ gem "aws-sigv4", "1.1.0"
13
+ gem "aws-sdk-core", "3.48.3"
14
+ gem "aws-sdk-kms", "1.16.0"
15
+ gem "aws-sdk-sqs", "1.13.0"
16
+ gem "aws-sdk-s3", "1.36.0"
17
+ gem "fluent-plugin-s3", "1.1.9"
@@ -1,29 +1,12 @@
1
- #
2
- # Copyright 2014-2019 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
1
  source 'https://rubygems.org'
16
2
 
17
3
  # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
18
4
  gemspec path: ".."
19
5
 
20
6
  # Specify related gems for td-agent v3.4.1
21
- # td-agent v3.4.0 has the same dependencies
22
7
  # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.1/config/projects/td-agent3.rb#L27
23
- # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.0/config/projects/td-agent3.rb#L27
24
8
  gem "fluentd", "1.4.2"
25
9
  # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.1/plugin_gems.rb#L16-L23
26
- # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.0/plugin_gems.rb#L16-L23
27
10
  gem "jmespath", "1.4.0"
28
11
  gem "aws-partitions", "1.149.0"
29
12
  gem "aws-sigv4", "1.1.0"
@@ -1,17 +1,3 @@
1
- #
2
- # Copyright 2014-2019 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
1
  source 'https://rubygems.org'
16
2
 
17
3
  # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
@@ -1,17 +1,3 @@
1
- #
2
- # Copyright 2014-2020 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
1
  source 'https://rubygems.org'
16
2
 
17
3
  # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v3.6.0
7
+ # https://github.com/treasure-data/omnibus-td-agent/blob/v3.6.0/config/projects/td-agent3.rb#L27
8
+ gem "fluentd", "1.9.2"
9
+ # https://github.com/treasure-data/omnibus-td-agent/blob/v3.6.0/plugin_gems.rb#L16-L23
10
+ gem "jmespath", "1.4.0"
11
+ gem "aws-partitions", "1.273.0"
12
+ gem "aws-sigv4", "1.1.0"
13
+ gem "aws-sdk-core", "3.90.0"
14
+ gem "aws-sdk-kms", "1.29.0"
15
+ gem "aws-sdk-sqs", "1.23.1"
16
+ gem "aws-sdk-s3", "1.60.2"
17
+ gem "fluent-plugin-s3", "1.3.0"
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v3.7.0
7
+ # https://docs.treasuredata.com/display/public/PD/The+td-agent+Change+Log
8
+ gem "fluentd", "1.10.0"
9
+ # https://github.com/treasure-data/omnibus-td-agent/commit/74920cb2a55e40195961a58c6b6de4bd5b3f1f87#diff-8d45eaa8758f7591f884c9e9917ea96105331a1daf5a891b4645b89e120f2d69R16-R23
10
+ gem "jmespath", "1.4.0"
11
+ gem "aws-partitions", "1.288.0"
12
+ gem "aws-sigv4", "1.1.1"
13
+ gem "aws-sdk-core", "3.92.0"
14
+ gem "aws-sdk-kms", "1.30.0"
15
+ gem "aws-sdk-sqs", "1.24.0"
16
+ gem "aws-sdk-s3", "1.61.1"
17
+ gem "fluent-plugin-s3", "1.3.0"
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v3.7.1
7
+ # https://github.com/treasure-data/omnibus-td-agent/blob/v3.7.1/config/projects/td-agent3.rb#L27
8
+ gem "fluentd", "1.10.2"
9
+ # https://github.com/treasure-data/omnibus-td-agent/blob/v3.7.1/plugin_gems.rb#L16-L23
10
+ gem "jmespath", "1.4.0"
11
+ gem "aws-partitions", "1.297.0"
12
+ gem "aws-sigv4", "1.1.1"
13
+ gem "aws-sdk-core", "3.94.0"
14
+ gem "aws-sdk-kms", "1.30.0"
15
+ gem "aws-sdk-sqs", "1.24.0"
16
+ gem "aws-sdk-s3", "1.63.0"
17
+ gem "fluent-plugin-s3", "1.3.1"
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v3.8.0
7
+ # https://github.com/treasure-data/omnibus-td-agent/blob/v3.8.0/config/projects/td-agent3.rb#L27
8
+ gem "fluentd", "1.11.1"
9
+ # https://github.com/treasure-data/omnibus-td-agent/blob/v3.8.0/plugin_gems.rb#L16-L23
10
+ gem "jmespath", "1.4.0"
11
+ gem "aws-partitions", "1.332.0"
12
+ gem "aws-sigv4", "1.2.0"
13
+ gem "aws-sdk-core", "3.100.0"
14
+ gem "aws-sdk-kms", "1.34.1"
15
+ gem "aws-sdk-sqs", "1.28.0"
16
+ gem "aws-sdk-s3", "1.69.1"
17
+ gem "fluent-plugin-s3", "1.3.2"
@@ -0,0 +1,18 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Maintenance release of td-agent v3
7
+ # Specify related gems for td-agent v3.8.1
8
+ # https://github.com/treasure-data/omnibus-td-agent/pull/273/files#diff-f73e763ace61e7c4bf48bf94bd6e295bc2cfd1ce5f9e38a4d19e266353e37498R27
9
+ gem "fluentd", "1.11.5"
10
+ # https://github.com/treasure-data/omnibus-td-agent/pull/273/files#diff-8d45eaa8758f7591f884c9e9917ea96105331a1daf5a891b4645b89e120f2d69R19-R25
11
+ gem "jmespath", "1.4.0"
12
+ gem "aws-partitions", "1.399.0"
13
+ gem "aws-sigv4", "1.2.2"
14
+ gem "aws-sdk-core", "3.109.3"
15
+ gem "aws-sdk-kms", "1.39.0"
16
+ gem "aws-sdk-sqs", "1.34.0"
17
+ gem "aws-sdk-s3", "1.85.0"
18
+ gem "fluent-plugin-s3", "1.4.0"
@@ -0,0 +1,25 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v4.0.0
7
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/master/CHANGELOG.md
8
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/41b3436d43c21e48a9cf34c58ae640f0e3dfb44c/td-agent/config.rb#L4
9
+ gem "fluentd", "1.11.1"
10
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/8a8721c2a0b05bc487fb81a04aa079c8bb4e47fb/gemfiles/linux/Gemfile#L31
11
+ gem "prometheus-client", "0.9.0"
12
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/8a8721c2a0b05bc487fb81a04aa079c8bb4e47fb/gemfiles/linux/Gemfile#L19-L20
13
+ gem "fluent-plugin-prometheus", "1.8.0"
14
+ gem "fluent-plugin-prometheus_pushgateway", "0.0.2"
15
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/8a8721c2a0b05bc487fb81a04aa079c8bb4e47fb/gemfiles/linux/Gemfile#L28
16
+ gem "jmespath", "1.4.0"
17
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/8a8721c2a0b05bc487fb81a04aa079c8bb4e47fb/gemfiles/linux/Gemfile#L8-L13
18
+ gem "aws-partitions", "1.337.0"
19
+ gem "aws-sdk-core", "3.102.1"
20
+ gem "aws-sdk-kms", "1.35.0"
21
+ gem "aws-sdk-s3", "1.72.0"
22
+ gem "aws-sdk-sqs", "1.29.0"
23
+ gem "aws-sigv4", "1.2.1"
24
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/8a8721c2a0b05bc487fb81a04aa079c8bb4e47fb/gemfiles/linux/Gemfile#L23
25
+ gem "fluent-plugin-s3", "1.3.3"
@@ -0,0 +1,21 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v4.0.1
7
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/master/CHANGELOG.md
8
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.0.1/td-agent/config.rb#L4
9
+ gem "fluentd", "1.11.2"
10
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.0.1/gemfiles/linux/Gemfile#L35-L42
11
+ gem "prometheus-client", "0.9.0"
12
+ gem "fluent-plugin-prometheus", "1.8.2"
13
+ gem "fluent-plugin-prometheus_pushgateway", "0.0.2"
14
+ gem "jmespath", "1.4.0"
15
+ gem "aws-partitions", "1.352.0"
16
+ gem "aws-sdk-core", "3.104.3"
17
+ gem "aws-sdk-kms", "1.36.0"
18
+ gem "aws-sdk-sqs", "1.30.0"
19
+ gem "aws-sigv4", "1.2.1"
20
+ gem "aws-sdk-s3", "1.75.0"
21
+ gem "fluent-plugin-s3", "1.4.0"
@@ -0,0 +1,21 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v4.1.0
7
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/master/CHANGELOG.md
8
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.1.0/td-agent/config.rb#L4
9
+ gem "fluentd", "1.12.1"
10
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.1.0/td-agent/Gemfile#L32-L42
11
+ gem "prometheus-client", "0.9.0"
12
+ gem "fluent-plugin-prometheus", "1.8.5"
13
+ gem "fluent-plugin-prometheus_pushgateway", "0.0.2"
14
+ gem "jmespath", "1.4.0"
15
+ gem "aws-partitions", "1.427.0"
16
+ gem "aws-sdk-core", "3.112.0"
17
+ gem "aws-sdk-kms", "1.42.0"
18
+ gem "aws-sdk-sqs", "1.36.0"
19
+ gem "aws-sigv4", "1.2.2"
20
+ gem "aws-sdk-s3", "1.88.1"
21
+ gem "fluent-plugin-s3", "1.5.1"
@@ -0,0 +1,21 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v4.1.1
7
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/master/CHANGELOG.md
8
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.1.1/td-agent/config.rb#L4
9
+ gem "fluentd", "1.12.3"
10
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.1.1/td-agent/Gemfile#L32-L42
11
+ gem "prometheus-client", "0.9.0"
12
+ gem "fluent-plugin-prometheus", "1.8.5"
13
+ gem "fluent-plugin-prometheus_pushgateway", "0.0.2"
14
+ gem "jmespath", "1.4.0"
15
+ gem "aws-partitions", "1.446.0"
16
+ gem "aws-sdk-core", "3.114.0"
17
+ gem "aws-sdk-kms", "1.43.0"
18
+ gem "aws-sdk-sqs", "1.38.0"
19
+ gem "aws-sigv4", "1.2.3"
20
+ gem "aws-sdk-s3", "1.93.1"
21
+ gem "fluent-plugin-s3", "1.6.0"
@@ -0,0 +1,21 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
4
+ gemspec path: ".."
5
+
6
+ # Specify related gems for td-agent v4.2.0
7
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/master/CHANGELOG.md
8
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.2.0/td-agent/config.rb#L4
9
+ gem "fluentd", "1.13.3"
10
+ # https://github.com/fluent-plugins-nursery/fluent-package-builder/blob/v4.2.0/td-agent/Gemfile#L42-L52
11
+ gem "prometheus-client", "2.1.0"
12
+ gem "fluent-plugin-prometheus", "2.0.1"
13
+ gem "fluent-plugin-prometheus_pushgateway", "0.1.0"
14
+ gem "jmespath", "1.4.0"
15
+ gem "aws-partitions", "1.478.0"
16
+ gem "aws-sdk-core", "3.117.0"
17
+ gem "aws-sdk-kms", "1.44.0"
18
+ gem "aws-sdk-sqs", "1.40.0"
19
+ gem "aws-sigv4", "1.2.4"
20
+ gem "aws-sdk-s3", "1.96.1"
21
+ gem "fluent-plugin-s3", "1.6.0"
@@ -84,6 +84,10 @@ module Fluent
84
84
  true
85
85
  end
86
86
 
87
+ def formatted_to_msgpack_binary?
88
+ true
89
+ end
90
+
87
91
  private
88
92
 
89
93
  def data_formatter_create(conf)
@@ -142,15 +146,13 @@ module Fluent
142
146
  include Fluent::MessagePackFactory::Mixin
143
147
  end
144
148
 
145
- def write_records_batch(chunk, &block)
149
+ def write_records_batch(chunk, stream_name, &block)
146
150
  unique_id = chunk.dump_unique_id_hex(chunk.unique_id)
147
- chunk.open do |io|
148
- records = msgpack_unpacker(io).to_enum
149
- split_to_batches(records) do |batch, size|
150
- log.debug(sprintf "Write chunk %s / %3d records / %4d KB", unique_id, batch.size, size/1024)
151
- batch_request_with_retry(batch, &block)
152
- log.debug("Finish writing chunk")
153
- end
151
+ records = chunk.to_enum(:msgpack_each)
152
+ split_to_batches(records) do |batch, size|
153
+ log.debug(sprintf "%s: Write chunk %s / %3d records / %4d KB", stream_name, unique_id, batch.size, size/1024)
154
+ batch_request_with_retry(batch, &block)
155
+ log.debug(sprintf "%s: Finish writing chunk", stream_name)
154
156
  end
155
157
  end
156
158
 
@@ -14,6 +14,7 @@
14
14
 
15
15
  require 'fluent_plugin_kinesis/version'
16
16
  require 'fluent/configurable'
17
+ require 'benchmark'
17
18
 
18
19
  module Fluent
19
20
  module Plugin
@@ -40,10 +41,12 @@ module Fluent
40
41
  module BatchRequest
41
42
  module BatchRequestParams
42
43
  include Fluent::Configurable
43
- config_param :retries_on_batch_request, :integer, default: 8
44
- config_param :reset_backoff_if_success, :bool, default: true
45
- config_param :batch_request_max_count, :integer, default: nil
46
- config_param :batch_request_max_size, :integer, default: nil
44
+ config_param :retries_on_batch_request, :integer, default: 8
45
+ config_param :reset_backoff_if_success, :bool, default: true
46
+ config_param :batch_request_max_count, :integer, default: nil
47
+ config_param :batch_request_max_size, :integer, default: nil
48
+ config_param :drop_failed_records_after_batch_request_retries, :bool, default: true
49
+ config_param :monitor_num_of_batch_request_retries, :bool, default: false
47
50
  end
48
51
 
49
52
  def self.included(mod)
@@ -96,11 +99,9 @@ module Fluent
96
99
  wait_second = backoff.next
97
100
  msg = 'Retrying to request batch. Retry count: %3d, Retry records: %3d, Wait seconds %3.2f' % [retry_count+1, failed_records.size, wait_second]
98
101
  log.warn(truncate msg)
99
- # TODO: sleep() doesn't wait the given seconds sometime.
100
- # The root cause is unknown so far, so I'd like to add debug print only. It should be fixed in the future.
101
- log.debug("#{Thread.current.object_id} sleep start")
102
- sleep(wait_second)
103
- log.debug("#{Thread.current.object_id} sleep finish")
102
+ # Increment num_errors to monitor batch request retries from "monitor_agent" or "fluent-plugin-prometheus"
103
+ increment_num_errors if @monitor_num_of_batch_request_retries
104
+ reliable_sleep(wait_second)
104
105
  batch_request_with_retry(retry_records(failed_records), retry_count+1, backoff: backoff, &block)
105
106
  else
106
107
  give_up_retries(failed_records)
@@ -108,6 +109,18 @@ module Fluent
108
109
  end
109
110
  end
110
111
 
112
+ # Sleep seems to not sleep as long as we ask it, our guess is that something wakes up the thread,
113
+ # so we keep on going to sleep if that happens.
114
+ # TODO: find out who is causing the sleep to be too short and try to make them stop it instead
115
+ def reliable_sleep(wait_second)
116
+ loop do
117
+ actual = Benchmark.realtime { sleep(wait_second) }
118
+ break if actual >= wait_second
119
+ log.error("#{Thread.current.object_id} sleep failed expected #{wait_second} but slept #{actual}")
120
+ wait_second -= actual
121
+ end
122
+ end
123
+
111
124
  def any_records_shipped?(res)
112
125
  results(res).size > failed_count(res)
113
126
  end
@@ -164,6 +177,49 @@ module Fluent
164
177
  record[:original]
165
178
  ])
166
179
  }
180
+
181
+ if @drop_failed_records_after_batch_request_retries
182
+ # Increment num_errors to monitor batch request failure from "monitor_agent" or "fluent-plugin-prometheus"
183
+ increment_num_errors
184
+ else
185
+ # Raise error and return chunk to Fluentd for retrying
186
+ case request_type
187
+ # @see https://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecords.html
188
+ # @see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Kinesis/Client.html#put_records-instance_method
189
+ # @see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Kinesis/Errors.html
190
+ when :streams, :streams_aggregated
191
+ provisioned_throughput_exceeded_records = failed_records.select { |record| record[:error_code] == 'ProvisionedThroughputExceededException' }
192
+ target_failed_record = provisioned_throughput_exceeded_records.first || failed_records.first
193
+ target_error = provisioned_throughput_exceeded_records.empty? ?
194
+ Aws::Kinesis::Errors::ServiceError :
195
+ Aws::Kinesis::Errors::ProvisionedThroughputExceededException
196
+ # @see https://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecords.html
197
+ # @see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Firehose/Client.html#put_record_batch-instance_method
198
+ # @see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Firehose/Errors.html
199
+ when :firehose
200
+ service_unavailable_exception_records = failed_records.select { |record| record[:error_code] == 'ServiceUnavailableException' }
201
+ target_failed_record = service_unavailable_exception_records.first || failed_records.first
202
+ target_error = service_unavailable_exception_records.empty? ?
203
+ Aws::Firehose::Errors::ServiceError :
204
+ Aws::Firehose::Errors::ServiceUnavailableException
205
+ end
206
+ log.error("Raise #{target_failed_record[:error_code]} and return chunk to Fluentd buffer for retrying")
207
+ raise target_error.new(Seahorse::Client::RequestContext.new, target_failed_record[:error_message])
208
+ end
209
+ end
210
+
211
+ def increment_num_errors
212
+ # Prepare Fluent::Plugin::Output instance variables to count errors in this method.
213
+ # These instance variables are initialized here for possible future breaking changes of Fluentd.
214
+ @num_errors ||= 0
215
+ # @see https://github.com/fluent/fluentd/commit/d245454658d16170431d276fcd5849fb0d88ab2b
216
+ if Gem::Version.new(Fluent::VERSION) >= Gem::Version.new('1.7.0')
217
+ @counter_mutex ||= Mutex.new
218
+ @counter_mutex.synchronize{ @num_errors += 1 }
219
+ else
220
+ @counters_monitor ||= Monitor.new
221
+ @counters_monitor.synchronize{ @num_errors += 1 }
222
+ end
167
223
  end
168
224
 
169
225
  class Backoff
@@ -46,6 +46,20 @@ module Fluent
46
46
  desc "A URL for a regional STS API endpoint, the default is global"
47
47
  config_param :sts_endpoint_url, :string, default: nil
48
48
  end
49
+ # Refer to the following link for additional parameters that could be added:
50
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/STS/Client.html#assume_role_with_web_identity-instance_method
51
+ config_section :web_identity_credentials, multi: false do
52
+ desc "The Amazon Resource Name (ARN) of the role to assume"
53
+ config_param :role_arn, :string
54
+ desc "An identifier for the assumed role session"
55
+ config_param :role_session_name, :string
56
+ desc "The absolute path to the file on disk containing the OIDC token"
57
+ config_param :web_identity_token_file, :string, default: nil #required
58
+ desc "An IAM policy in JSON format"
59
+ config_param :policy, :string, default: nil
60
+ desc "The duration, in seconds, of the role session (900-43200)"
61
+ config_param :duration_seconds, :time, default: nil
62
+ end
49
63
  config_section :instance_profile_credentials, multi: false do
50
64
  desc "Number of times to retry when retrieving credentials"
51
65
  config_param :retries, :integer, default: nil
@@ -149,6 +163,17 @@ module Fluent
149
163
  credentials_options[:client] = Aws::STS::Client.new(region: @region)
150
164
  end
151
165
  options[:credentials] = Aws::AssumeRoleCredentials.new(credentials_options)
166
+ when @web_identity_credentials
167
+ c = @web_identity_credentials
168
+ credentials_options[:role_arn] = c.role_arn
169
+ credentials_options[:role_session_name] = c.role_session_name
170
+ credentials_options[:web_identity_token_file] = c.web_identity_token_file
171
+ credentials_options[:policy] = c.policy if c.policy
172
+ credentials_options[:duration_seconds] = c.duration_seconds if c.duration_seconds
173
+ if @region
174
+ credentials_options[:client] = Aws::STS::Client.new(:region => @region)
175
+ end
176
+ options[:credentials] = Aws::AssumeRoleWebIdentityCredentials.new(credentials_options)
152
177
  when @instance_profile_credentials
153
178
  c = @instance_profile_credentials
154
179
  credentials_options[:retries] = c.retries if c.retries
@@ -44,12 +44,13 @@ module Fluent
44
44
  end
45
45
 
46
46
  def write(chunk)
47
- write_records_batch(chunk) do |batch|
47
+ delivery_stream_name = extract_placeholders(@delivery_stream_name, chunk)
48
+ write_records_batch(chunk, delivery_stream_name) do |batch|
48
49
  records = batch.map{|(data)|
49
50
  { data: data }
50
51
  }
51
52
  client.put_record_batch(
52
- delivery_stream_name: @delivery_stream_name,
53
+ delivery_stream_name: delivery_stream_name,
53
54
  records: records,
54
55
  )
55
56
  end
@@ -42,7 +42,7 @@ module Fluent
42
42
 
43
43
  def write(chunk)
44
44
  stream_name = extract_placeholders(@stream_name, chunk)
45
- write_records_batch(chunk) do |batch|
45
+ write_records_batch(chunk, stream_name) do |batch|
46
46
  records = batch.map{|(data, partition_key)|
47
47
  { data: data, partition_key: partition_key }
48
48
  }
@@ -44,7 +44,7 @@ module Fluent
44
44
 
45
45
  def write(chunk)
46
46
  stream_name = extract_placeholders(@stream_name, chunk)
47
- write_records_batch(chunk) do |batch|
47
+ write_records_batch(chunk, stream_name) do |batch|
48
48
  key = @partition_key_generator.call
49
49
  records = batch.map{|(data)|data}
50
50
  client.put_records(
@@ -13,5 +13,5 @@
13
13
  # language governing permissions and limitations under the License.
14
14
 
15
15
  module FluentPluginKinesis
16
- VERSION = '3.2.2'
16
+ VERSION = '3.4.1'
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-kinesis
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2021-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -101,9 +101,6 @@ dependencies:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '3'
104
- - - "<"
105
- - !ruby/object:Gem::Version
106
- version: '3.12'
107
104
  type: :runtime
108
105
  prerelease: false
109
106
  version_requirements: !ruby/object:Gem::Requirement
@@ -111,9 +108,6 @@ dependencies:
111
108
  - - "~>"
112
109
  - !ruby/object:Gem::Version
113
110
  version: '3'
114
- - - "<"
115
- - !ruby/object:Gem::Version
116
- version: '3.12'
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: bundler
119
113
  requirement: !ruby/object:Gem::Requirement
@@ -290,15 +284,26 @@ files:
290
284
  - benchmark/task.rake
291
285
  - fluent-plugin-kinesis.gemspec
292
286
  - gemfiles/Gemfile.fluentd-0.14.22
293
- - gemfiles/Gemfile.fluentd-1.9.1
287
+ - gemfiles/Gemfile.fluentd-1.13.3
294
288
  - gemfiles/Gemfile.td-agent-3.1.0
295
289
  - gemfiles/Gemfile.td-agent-3.1.1
296
290
  - gemfiles/Gemfile.td-agent-3.2.0
297
291
  - gemfiles/Gemfile.td-agent-3.2.1
298
292
  - gemfiles/Gemfile.td-agent-3.3.0
293
+ - gemfiles/Gemfile.td-agent-3.4.0
299
294
  - gemfiles/Gemfile.td-agent-3.4.1
300
295
  - gemfiles/Gemfile.td-agent-3.5.0
301
296
  - gemfiles/Gemfile.td-agent-3.5.1
297
+ - gemfiles/Gemfile.td-agent-3.6.0
298
+ - gemfiles/Gemfile.td-agent-3.7.0
299
+ - gemfiles/Gemfile.td-agent-3.7.1
300
+ - gemfiles/Gemfile.td-agent-3.8.0
301
+ - gemfiles/Gemfile.td-agent-3.8.1
302
+ - gemfiles/Gemfile.td-agent-4.0.0
303
+ - gemfiles/Gemfile.td-agent-4.0.1
304
+ - gemfiles/Gemfile.td-agent-4.1.0
305
+ - gemfiles/Gemfile.td-agent-4.1.1
306
+ - gemfiles/Gemfile.td-agent-4.2.0
302
307
  - lib/fluent/plugin/kinesis.rb
303
308
  - lib/fluent/plugin/kinesis_helper/aggregator.rb
304
309
  - lib/fluent/plugin/kinesis_helper/api.rb
@@ -326,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
331
  - !ruby/object:Gem::Version
327
332
  version: '0'
328
333
  requirements: []
329
- rubygems_version: 3.0.3
334
+ rubygems_version: 3.1.4
330
335
  signing_key:
331
336
  specification_version: 4
332
337
  summary: Fluentd output plugin that sends events to Amazon Kinesis.
@@ -1,20 +0,0 @@
1
- #
2
- # Copyright 2014-2020 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
- source 'https://rubygems.org'
16
-
17
- # Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
18
- gemspec path: ".."
19
-
20
- gem "fluentd", "1.9.1"