fluent-plugin-kinesis 3.2.3 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +46 -26
  4. data/CHANGELOG.md +20 -0
  5. data/CONTRIBUTORS.txt +2 -0
  6. data/README.md +56 -3
  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 +0 -14
  20. data/gemfiles/Gemfile.td-agent-3.7.0 +17 -0
  21. data/gemfiles/Gemfile.td-agent-3.7.1 +0 -14
  22. data/gemfiles/Gemfile.td-agent-3.8.0 +0 -14
  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 +13 -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/kinesis_helper/compression.rb +27 -0
  33. data/lib/fluent/plugin/out_kinesis_firehose.rb +1 -1
  34. data/lib/fluent/plugin/out_kinesis_streams.rb +1 -1
  35. data/lib/fluent/plugin/out_kinesis_streams_aggregated.rb +1 -1
  36. data/lib/fluent_plugin_kinesis/version.rb +1 -1
  37. metadata +13 -10
  38. data/gemfiles/Gemfile.fluentd-1.11.1 +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1bd84d96b64e32b8aac649672adeb5333c7931cb7a7b5a4ec13cd6a8031f1be
4
- data.tar.gz: 657ed567a713283fbc40c6ea7ed1fe7cc940f7898547e584aa4ed447fbfabdd6
3
+ metadata.gz: 2a80a4e62aad6b32241c8db4ce69903db51da13b06391d9762737ef9b39a3987
4
+ data.tar.gz: 6dd4150b29f65e50980dd8977227de8675a6125b3d3977fe20089650f76bae90
5
5
  SHA512:
6
- metadata.gz: 6da3c960496b64b446718ff79cd95523c3058372893e313a5049ca3fad51895a613bc06b5ce5e8dc6a71966b5c0dbe00fcfd9b0b5ff7438813f0be581efc1122
7
- data.tar.gz: e5fff3586fd0f1519a9f686ccaca4212a45b30c9f7199fb82460bbd04d4a98c080fe1c93bf1dc33099b432dab9da4118a943c619e31069b082ce98ac366b80e2
6
+ metadata.gz: 26ef149f10a4e953573bacdc3bf19185edeff7d13fc72058bc02d93d453d9573455eb9a9f5d75e0016ece72b1f0440f2431a0351ce9d988784de6a273efc3a9c
7
+ data.tar.gz: 1e591b860e4f1d4d2152d1b1327488da16d0efc2273d5ceff214180fb58f38bfc78d25859166b0ab67e4f883e140a2d5242a5a3dd95161cc8f2084f58cc9e7ac
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,35 +2,55 @@ language: ruby
2
2
  os: linux
3
3
  sudo: false
4
4
 
5
- gemfile:
6
- - Gemfile
7
- - gemfiles/Gemfile.td-agent-3.8.0
8
-
9
5
  # Test with supported td-agent versions
10
- # https://tddocs.atlassian.net/wiki/spaces/PD/pages/6291635/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.6 # Latest supported Ruby / https://www.ruby-lang.org/en/downloads/
14
- # Waiting protobuf support for Ruby 2.7 / https://github.com/protocolbuffers/protobuf/issues/7070
15
- gemfile: gemfiles/Gemfile.fluentd-1.11.1 # Latest Fluentd / https://www.fluentd.org/download
16
- - rvm: 2.3.0 # Oldest supported Ruby
17
- gemfile: gemfiles/Gemfile.fluentd-0.14.22 # Oldest supported Fluentd
18
- - rvm: 2.4.2 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.1.1/config/projects/td-agent3.rb#L17
19
- gemfile: gemfiles/Gemfile.td-agent-3.1.1
20
- - rvm: 2.4.4 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.2.1/config/projects/td-agent3.rb#L22
21
- gemfile: gemfiles/Gemfile.td-agent-3.2.1
22
- - rvm: 2.4.5 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.3.0/config/projects/td-agent3.rb#L22
23
- gemfile: gemfiles/Gemfile.td-agent-3.3.0
24
- - rvm: 2.4.6 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.4.1/config/projects/td-agent3.rb#L22
25
- gemfile: gemfiles/Gemfile.td-agent-3.4.1
26
- - rvm: 2.4.9 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.5.1/config/projects/td-agent3.rb#L22
27
- gemfile: gemfiles/Gemfile.td-agent-3.5.1
28
- - rvm: 2.4.9 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.6.0/config/projects/td-agent3.rb#L22
29
- gemfile: gemfiles/Gemfile.td-agent-3.6.0
30
- - rvm: 2.4.10 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.7.1/config/projects/td-agent3.rb#L22
31
- gemfile: gemfiles/Gemfile.td-agent-3.7.1
32
- - rvm: 2.4.10 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.8.0/config/projects/td-agent3.rb#L22
33
- gemfile: gemfiles/Gemfile.td-agent-3.8.0
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
34
54
  fast_finish: true
35
55
 
36
56
  script: bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.4.2
4
+ - Feature - Add option to support gzip compression : [#215](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/215)
5
+
6
+ ## 3.4.1
7
+
8
+ - Enhancement - Add stream name to debug logs to identify : [#214](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/214)
9
+ - Enhancement - Add td-agent 4.1.1, 4.2.0 and Fluentd 1.13.3 with Ruby 3.0.2 to test cases
10
+
11
+ ## 3.4.0
12
+
13
+ - 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)
14
+ - Enhancement - Make sleep reliable by measuring actual slept time : [#162](https://github.com/awslabs/aws-fluent-plugin-kinesis/pull/162)
15
+ - Enhancement - Add td-agent 4.1.0 and Fluentd 1.12.3 to test cases
16
+
17
+ ## 3.3.0
18
+
19
+ - 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)
20
+ - 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)
21
+ - Enhancement - Add td-agent v4 (4.0.1) and Fluentd 1.11.2 to test cases
22
+
3
23
  ## 3.2.3
4
24
 
5
25
  - 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)
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.
@@ -310,7 +353,7 @@ Also, there are some format related options below:
310
353
  If your record contains a field whose string should be sent to Amazon Kinesis directly (without formatter), use this parameter to specify the field. In that case, other fields than **data_key** are thrown away and never sent to Amazon Kinesis. Default `nil`, which means whole record will be formatted and sent.
311
354
 
312
355
  ### compression
313
- Specifing compression way for data of each record. Current accepted options are `zlib`. Otherwise, no compression will be preformed.
356
+ Specifying compression way for data of each record. Current accepted options are `zlib` and `gzip`. Otherwise, no compression will be preformed.
314
357
 
315
358
  ### log_truncate_max_size
316
359
  Integer, default 1024. When emitting the log entry, the message will be truncated by this size to avoid infinite loop when the log is also sent to Kinesis. The value 0 means no truncation.
@@ -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
 
@@ -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
@@ -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.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"
@@ -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
@@ -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,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"
@@ -17,6 +17,7 @@ require 'fluent/msgpack_factory'
17
17
  require 'fluent/plugin/output'
18
18
  require 'fluent/plugin/kinesis_helper/client'
19
19
  require 'fluent/plugin/kinesis_helper/api'
20
+ require 'fluent/plugin/kinesis_helper/compression'
20
21
  require 'zlib'
21
22
 
22
23
  module Fluent
@@ -84,6 +85,10 @@ module Fluent
84
85
  true
85
86
  end
86
87
 
88
+ def formatted_to_msgpack_binary?
89
+ true
90
+ end
91
+
87
92
  private
88
93
 
89
94
  def data_formatter_create(conf)
@@ -117,6 +122,8 @@ module Fluent
117
122
  case @compression
118
123
  when "zlib"
119
124
  ->(data) { Zlib::Deflate.deflate(data) }
125
+ when "gzip"
126
+ ->(data) { Gzip.compress(data) }
120
127
  else
121
128
  ->(data) { data }
122
129
  end
@@ -142,15 +149,13 @@ module Fluent
142
149
  include Fluent::MessagePackFactory::Mixin
143
150
  end
144
151
 
145
- def write_records_batch(chunk, &block)
152
+ def write_records_batch(chunk, stream_name, &block)
146
153
  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
154
+ records = chunk.to_enum(:msgpack_each)
155
+ split_to_batches(records) do |batch, size|
156
+ log.debug(sprintf "%s: Write chunk %s / %3d records / %4d KB", stream_name, unique_id, batch.size, size/1024)
157
+ batch_request_with_retry(batch, &block)
158
+ log.debug(sprintf "%s: Finish writing chunk", stream_name)
154
159
  end
155
160
  end
156
161
 
@@ -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
@@ -0,0 +1,27 @@
1
+ require "stringio"
2
+ require "zlib"
3
+
4
+ class Stream < StringIO
5
+ def initialize(*)
6
+ super
7
+ set_encoding "BINARY"
8
+ end
9
+
10
+ def close
11
+ rewind;
12
+ end
13
+ end
14
+
15
+ class Gzip
16
+ def self.compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY)
17
+ output = Stream.new
18
+ gz = Zlib::GzipWriter.new(output, level, strategy)
19
+ gz.write(string)
20
+ gz.close
21
+ output.string
22
+ end
23
+
24
+ def self.decompress(string)
25
+ Zlib::GzipReader.wrap(StringIO.new(string), &:read)
26
+ end
27
+ end
@@ -45,7 +45,7 @@ module Fluent
45
45
 
46
46
  def write(chunk)
47
47
  delivery_stream_name = extract_placeholders(@delivery_stream_name, chunk)
48
- write_records_batch(chunk) do |batch|
48
+ write_records_batch(chunk, delivery_stream_name) do |batch|
49
49
  records = batch.map{|(data)|
50
50
  { data: data }
51
51
  }
@@ -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.3'
16
+ VERSION = '3.4.2'
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.3
4
+ version: 3.4.2
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-07-15 00:00:00.000000000 Z
11
+ date: 2021-11-14 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,22 +284,31 @@ 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.11.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
302
297
  - gemfiles/Gemfile.td-agent-3.6.0
298
+ - gemfiles/Gemfile.td-agent-3.7.0
303
299
  - gemfiles/Gemfile.td-agent-3.7.1
304
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
305
307
  - lib/fluent/plugin/kinesis.rb
306
308
  - lib/fluent/plugin/kinesis_helper/aggregator.rb
307
309
  - lib/fluent/plugin/kinesis_helper/api.rb
308
310
  - lib/fluent/plugin/kinesis_helper/client.rb
311
+ - lib/fluent/plugin/kinesis_helper/compression.rb
309
312
  - lib/fluent/plugin/out_kinesis_firehose.rb
310
313
  - lib/fluent/plugin/out_kinesis_streams.rb
311
314
  - lib/fluent/plugin/out_kinesis_streams_aggregated.rb
@@ -329,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
332
  - !ruby/object:Gem::Version
330
333
  version: '0'
331
334
  requirements: []
332
- rubygems_version: 3.0.3
335
+ rubygems_version: 3.1.4
333
336
  signing_key:
334
337
  specification_version: 4
335
338
  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.11.1"