logstash-input-kinesis 2.0.8-java → 2.0.10-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c30c3e57fd6684ef7828d46cae719101d821da13610d59b14943c4a98781968
4
- data.tar.gz: 98599b307cf033adbc3f295182e7ef48780f0d933e33d3c803b341f2581f083d
3
+ metadata.gz: e043e41cda349ab19d8a7d315d12053e85720655957ecdd2bfa14c8004b3f251
4
+ data.tar.gz: 7f45606c39c9afe600125b147426fc6187ffccff94a8b202cda6c4e51391393e
5
5
  SHA512:
6
- metadata.gz: d40c14d095aaab40a03d0234cf40ace49426346833cd9937312e501b06adfa523e214594d67fd5e8891c785c3b2c545807c240062e0d4f7e541301e287dedf0a
7
- data.tar.gz: e0a3251ecdacaf66147313c7e518670804c8465db5036b787df9ec613a7ee4b3878d8210ff48546e487ec785f3a9191b5e6402b318372f171bd68fb9680ffe8f
6
+ metadata.gz: 2a49ae6fee952b540b522dca5cbab79cbdaabf68c2e9e628f1f88fbeea3b89f0bf4f03e8dfea65284d9125d68365e702536ee096dc161bcedb8eb9fe15120ba3
7
+ data.tar.gz: 67fa5c368c1924e31d3a47ad4082d06c957ade7c6d36e7d8023e54cd06a113bf1f2bd4de84d426bb68911f3a1f36e7eb5dc1ff73bb14cf5803554b7a5c621b21
@@ -1,3 +1,9 @@
1
+ ## 2.0.10
2
+ - Added the ability to set additional settings exposed through KinesisClientLibConfiguration [#51](https://github.com/logstash-plugins/logstash-input-kinesis/pull/51)
3
+
4
+ ## 2.0.9
5
+ - Changed the 'workerid' to also include the host of the Logstash node [#48](https://github.com/logstash-plugins/logstash-input-kinesis/pull/48)
6
+
1
7
  ## 2.0.8
2
8
  - Changed plugin to use more recent versions of Kinesis Client library and AWS SDK[#45](https://github.com/logstash-plugins/logstash-input-kinesis/pull/45)
3
9
 
data/README.md CHANGED
@@ -53,6 +53,11 @@ This are the properties you can configure and what are the default values:
53
53
  * **required**: false
54
54
  * **default value**: `"TRIM_HORIZON"`
55
55
 
56
+ ### Additional KCL Settings
57
+ * `additional_settings`: The KCL provides several configuration options which can be set in [KinesisClientLibConfiguration](https://github.com/awslabs/amazon-kinesis-client/blob/master/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/coordinator/KinesisClientLibConfiguration.java). These options are configured via various function calls that all begin with `with`. Some of these functions take complex types, which are not supported. However, you may invoke any one of the `withX()` functions that take a primitive by providing key-value pairs in `snake_case`. For example, to set the dynamodb read and write capacity values, two functions exist, withInitialLeaseTableReadCapacity and withInitialLeaseTableWriteCapacity. To set a value for these, provide a hash of `additional_settings => {"initial_lease_table_read_capacity" => 25, "initial_lease_table_write_capacity" => 100}`
58
+ * **required**: false
59
+ * **default value**: `{}`
60
+
56
61
  ## Authentication
57
62
 
58
63
  This plugin uses the default AWS SDK auth chain, [DefaultAWSCredentialsProviderChain](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html), to determine which credentials the client will use, unless `profile` is set, in which case [ProfileCredentialsProvider](http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/profile/ProfileCredentialsProvider.html) is used.
@@ -1,4 +1,6 @@
1
1
  # encoding: utf-8
2
+
3
+ require "socket"
2
4
  require "logstash/inputs/base"
3
5
  require "logstash/errors"
4
6
  require "logstash/environment"
@@ -56,6 +58,9 @@ class LogStash::Inputs::Kinesis < LogStash::Inputs::Base
56
58
  # Select initial_position_in_stream. Accepts TRIM_HORIZON or LATEST
57
59
  config :initial_position_in_stream, :validate => ["TRIM_HORIZON", "LATEST"], :default => "TRIM_HORIZON"
58
60
 
61
+ # Any additional arbitrary kcl options configurable in the KinesisClientLibConfiguration
62
+ config :additional_settings, :validate => :hash, :default => {}
63
+
59
64
  def initialize(params = {})
60
65
  super(params)
61
66
  end
@@ -69,7 +74,9 @@ class LogStash::Inputs::Kinesis < LogStash::Inputs::Base
69
74
  kinesis_logger.setLevel(org.apache.log4j::Level::WARN)
70
75
  end
71
76
 
72
- worker_id = java.util::UUID.randomUUID.to_s
77
+ hostname = Socket.gethostname
78
+ uuid = java.util::UUID.randomUUID.to_s
79
+ worker_id = "#{hostname}:#{uuid}"
73
80
 
74
81
  # If the AWS profile is set, use the profile credentials provider.
75
82
  # Otherwise fall back to the default chain.
@@ -91,6 +98,13 @@ class LogStash::Inputs::Kinesis < LogStash::Inputs::Base
91
98
  worker_id).
92
99
  withInitialPositionInStream(initial_position_in_stream).
93
100
  withRegionName(@region)
101
+
102
+ # Call arbitrary "withX()" functions
103
+ # snake_case => withCamelCase happens automatically
104
+ @additional_settings.each do |key, value|
105
+ fn = "with_#{key}"
106
+ @kcl_config.send(fn, value)
107
+ end
94
108
  end
95
109
 
96
110
  def run(output_queue)
@@ -2,7 +2,7 @@
2
2
  module Logstash
3
3
  module Input
4
4
  module Kinesis
5
- VERSION = "2.0.8"
5
+ VERSION = "2.0.10"
6
6
  end
7
7
  end
8
8
  end
@@ -38,6 +38,50 @@ RSpec.describe "inputs/kinesis" do
38
38
  "initial_position_in_stream" => "LATEST"
39
39
  }}
40
40
 
41
+ # Config hash to test valid additional_settings
42
+ let(:config_with_valid_additional_settings) {{
43
+ "application_name" => "my-processor",
44
+ "kinesis_stream_name" => "run-specs",
45
+ "codec" => codec,
46
+ "metrics" => metrics,
47
+ "checkpoint_interval_seconds" => 120,
48
+ "region" => "ap-southeast-1",
49
+ "profile" => nil,
50
+ "additional_settings" => {
51
+ "initial_lease_table_read_capacity" => 25,
52
+ "initial_lease_table_write_capacity" => 100,
53
+ "kinesis_endpoint" => "http://localhost"
54
+ }
55
+ }}
56
+
57
+ # Config hash to test invalid additional_settings where the name is not found
58
+ let(:config_with_invalid_additional_settings_name_not_found) {{
59
+ "application_name" => "my-processor",
60
+ "kinesis_stream_name" => "run-specs",
61
+ "codec" => codec,
62
+ "metrics" => metrics,
63
+ "checkpoint_interval_seconds" => 120,
64
+ "region" => "ap-southeast-1",
65
+ "profile" => nil,
66
+ "additional_settings" => {
67
+ "foo" => "bar"
68
+ }
69
+ }}
70
+
71
+ # Config hash to test invalid additional_settings where the type is complex or wrong
72
+ let(:config_with_invalid_additional_settings_wrong_type) {{
73
+ "application_name" => "my-processor",
74
+ "kinesis_stream_name" => "run-specs",
75
+ "codec" => codec,
76
+ "metrics" => metrics,
77
+ "checkpoint_interval_seconds" => 120,
78
+ "region" => "ap-southeast-1",
79
+ "profile" => nil,
80
+ "additional_settings" => {
81
+ "metrics_level" => "invalid_metrics_level"
82
+ }
83
+ }}
84
+
41
85
  subject!(:kinesis) { LogStash::Inputs::Kinesis.new(config) }
42
86
  let(:kcl_worker) { double('kcl_worker') }
43
87
  let(:stub_builder) { double('kcl_builder', build: kcl_worker) }
@@ -77,6 +121,33 @@ RSpec.describe "inputs/kinesis" do
77
121
  expect(kinesis_with_latest.kcl_config.get_kinesis_credentials_provider.getClass.to_s).to eq("com.amazonaws.auth.DefaultAWSCredentialsProviderChain")
78
122
  end
79
123
 
124
+ subject!(:kinesis_with_valid_additional_settings) { LogStash::Inputs::Kinesis.new(config_with_valid_additional_settings) }
125
+
126
+ it "configures the KCL" do
127
+ kinesis_with_valid_additional_settings.register
128
+ expect(kinesis_with_valid_additional_settings.kcl_config.applicationName).to eq("my-processor")
129
+ expect(kinesis_with_valid_additional_settings.kcl_config.streamName).to eq("run-specs")
130
+ expect(kinesis_with_valid_additional_settings.kcl_config.regionName).to eq("ap-southeast-1")
131
+ expect(kinesis_with_valid_additional_settings.kcl_config.initialLeaseTableReadCapacity).to eq(25)
132
+ expect(kinesis_with_valid_additional_settings.kcl_config.initialLeaseTableWriteCapacity).to eq(100)
133
+ expect(kinesis_with_valid_additional_settings.kcl_config.kinesisEndpoint).to eq("http://localhost")
134
+ end
135
+
136
+
137
+ subject!(:kinesis_with_invalid_additional_settings_name_not_found) { LogStash::Inputs::Kinesis.new(config_with_invalid_additional_settings_name_not_found) }
138
+
139
+ it "raises NoMethodError for invalid configuration options" do
140
+ expect{ kinesis_with_invalid_additional_settings_name_not_found.register }.to raise_error(NoMethodError)
141
+ end
142
+
143
+
144
+ subject!(:kinesis_with_invalid_additional_settings_wrong_type) { LogStash::Inputs::Kinesis.new(config_with_invalid_additional_settings_wrong_type) }
145
+
146
+ it "raises an error for invalid configuration values such as the wrong type" do
147
+ expect{ kinesis_with_invalid_additional_settings_wrong_type.register }.to raise_error(Java::JavaLang::IllegalArgumentException)
148
+ end
149
+
150
+
80
151
  context "#run" do
81
152
  it "runs the KCL worker" do
82
153
  expect(kinesis).to receive(:kcl_builder).with(queue).and_return(stub_builder)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-kinesis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.0.10
5
5
  platform: java
6
6
  authors:
7
7
  - Brian Palmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-25 00:00:00.000000000 Z
11
+ date: 2018-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement